PDA

View Full Version : Slipt edges as smooth transition between objects



Jamiro
01-17-2018, 08:11 PM
Hello,

I'm currently trying to do the inverse of the edge splitting with 2 or more objects in order to get a smooth visible transition while using light.

this is the problem so far:

https://i.imgur.com/NhgLTMq.png

this is what I want it to look like:

https://i.imgur.com/DoU9cDM.png

I think I need to change the normals but don't know to what, but I wanted to know if this is possible with shaders or if there is any other possibility.

Regards,
Jamiro

GClements
01-18-2018, 12:29 AM
You need to force the vertices along the shared edge to have the same normal in both objects. Typically, you'd just average the two normals, normalise (if needed), and assign the result to both vertices.

You probably can't do this with shaders, as the shader invocation for one vertex won't have the other vertex' normal available to it.

Jamiro
01-18-2018, 02:42 AM
You need to force the vertices along the shared edge to have the same normal in both objects. Typically, you'd just average the two normals, normalise (if needed), and assign the result to both vertices.

So, could I just point those vertices normals up (like [0, 1, 0])? Because I can't access the vertices from one object while processing another object.



You probably can't do this with shaders, as the shader invocation for one vertex won't have the other vertex' normal available to it.

Sure, but what I really meant was if discarding the normal lighing system and using a shader-based lighing would this still be an issue? Because I never used one, I don't know if I can calculate normals on the fragment base.

thanks for time.

GClements
01-18-2018, 06:10 AM
So, could I just point those vertices normals up (like [0, 1, 0])?
That would avoid the discontinuity. But it would look wrong in other ways.


Because I can't access the vertices from one object while processing another object.Then you need to change that. The normals along the edge of one object need to take the other object into account in their calculation.


Sure, but what I really meant was if discarding the normal lighing system and using a shader-based lighing would this still be an issue? Because I never used one, I don't know if I can calculate normals on the fragment base.
You still need vertex normals when using shaders.

Jamiro
01-18-2018, 09:00 AM
Thanks

PS: just need to type more, it was too short to post.