Jump to content

Better Outline for Mesh


iiceman
 Share

Recommended Posts

why dont use frensel  for that ?

 

http://www.babylonjs.com/cyos/#2KUJ1T

If you're goal is just to shade the fragments that are almost at a tangent to the view surely ramping/thresholding a rim shader would make more sense than messing with Shlick's approximation of the Fresnel term?

 

I was actually playing with a rim shader recently and I'm very much a noob but I managed to move half of it back into the vertex shader and have it still look ok (I think). Well for not for a flat shaded low poly cube, but I'm guessing the Fresnel effect doesn't give that nice outlines either right? You kind of assume smooth continuous contours if you expect your Fresnel highlights to be an edge right?

 

Regarding doing edge's with geometry, now that you have a way to clone a mesh to separate geometry, I think if you can renormalise it so it is all smooth (ie. no caps on the cylinders) before you push it out along the normals* it will solve the issue you had in the earlier PGs (sorry if you already figured this out, thought I'd mention it though as I wasn't sure... am not a Babylon user so I don't know 100% that recalculating the normals will smooth the cylinder caps and cube edges so this advice comes untested, but if you verts are all shared you shouldn't get the breaks in the outlines you were seeing earlier)

*nevermind, I see you are just scaling the mesh not doing anything with the normals

Link to comment
Share on other sites

Hi chg,

 

sounds like you know a thing or two about shaders and mesh, but you are not a babylon user? O_o Why not!? ;)

 

[...] I was actually playing with a rim shader recently [...]

Show us! :D

 

I still assume there is an awesome solution with shaders for the outline thing and I am pretttyyyy sure somebody around here can do it. I am just beeing patient and wait untill somebody does it for me and in the meantime I try to find a working alternative that I can somehow comprehend with my current knowledge ;) I think the version with the cloned mesh and the copied geometry is already pretty good, I try it out a bit more tonight and let you guys know how it went.

Link to comment
Share on other sites

i can make outline by shader 

 

1. we need make a mesh bigger than old mesh 

 

     ** best way : newpos = oldpos + normal*len;

     in case :    vec4 outPosition = worldViewProjection * vec4(position+normal*0.3, 1.0)

 

2. just discard inside and show oldMesh

 

http://www.babylonjs.com/cyos/#2KUJ1T#1

 

compare 2 mesh you see the new mesh have old mesh inside and just show outline with any material you want.

Link to comment
Share on other sites

It's not exactly what I imagined for the outline, but it's super cool! :D It looks like a force field or something like that. If you can make it into a material you can still participate in the November challenge with it, I am sure that material would be useful somehow!

 

By the way: I like the second one from the right best ;)

Link to comment
Share on other sites

By the way, here is the current use case for the outline thingy: http://p215008.mittwaldserver.info/mapEditor2.0/MapEditor/

 

I restarted the simple editor that I planed to make for a long time now. I decided to strat from scratch again and use angular for the UI. The idea is to generate the interface dynamically based on the attributes for each object. Therefor I store only the data that I want to make editable in a json file. 

 

One for general mesh options and properties: http://p215008.mittwaldserver.info/mapEditor2.0/MapEditor/data/abstractMeshBlueprint.json

And one for mesh specific stuff: http://p215008.mittwaldserver.info/mapEditor2.0/MapEditor/data/meshBlueprints.json

 

Same for materials (still working on that - maybe I can steal some stuff from raananWs material editor http://materialeditor.raananweber.com/ ... or even import stuff created there).

 

The goal is that I only need to edit the json file to add new meshes (custom mesh, too later on) and get a super simple editor to place some meshes and give them materials on the go. If that all works I try to save that as a babylon file and add some more features to improve the editor. But so far babylon and angular work together great! (And the selection looks cool, too, except for the plane. I guess I have to do it differently for the planes).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...