Normals? How Can I Fix

BlitzMax Forums/MiniB3D Module/Normals? How Can I Fix

FBEpyon(Posted 2014) [#1]
Hello,

So I have a problem that I am unable to fix, these normals are not working correctly, and things look so weird. I'm trying to make it look more like old school ISO terrain, and I can't get the shadowing to work correctly..

[IMG]http://i270.photobucket.com/albums/jj119/fbepyon/screen_zps36c5f249.png[/IMG]

If anyone has a suggestion that would be great!!

Thanks,


GaryV(Posted 2014) [#2]



FBEpyon(Posted 2014) [#3]
Thanks for fixing that for me, I was using the wrong codes for the forums..

Anyways.. What I'm trying to get is the top bright and the sides shaded if you haven't seen classic Isometric 2d terrain, but if you have you would know what I'm talking about.

If Minib3d had the shaders built into it, I would go that way as well, but for now I'm working vanilla for this.

Thanks..


AdamRedwoods(Posted 2014) [#4]
are you "mesh.UpdateNormals()" on your mesh?
how are you creating your terrain?


FBEpyon(Posted 2014) [#5]
I did the mesh.UpdateNormals(), I can send you the terrain mesh code, if you would like to see it.

Thanks


Kryzon(Posted 2014) [#6]
Are you using the flat-shaded flag (EntityFX 4) ?


FBEpyon(Posted 2014) [#7]
Yes I am.


Kryzon(Posted 2014) [#8]
Try turning it off please. It gives those triangular artefacts.


FBEpyon(Posted 2014) [#9]
I does the same thing, I turned it on so you could see it, but I wanted the flat look anyways, so looking for a way to achieve this effect.

Thanks


Kryzon(Posted 2014) [#10]
What is usually done is to duplicate a vertex when you need more than one normal at that same point.

Using pure hardware flat-shading does not always work, as you can see.
You need to work on a software level, breaking the vertices of your mesh and welding back the ones that belong to coplanar triangles.
Then recalculate the vertex normals as the normalized cross-product of the counter-clockwise vertices of a triangle.

Further reading:
http://blitzbasic.com/Community/posts.php?topic=100925


*(Posted 2014) [#11]
If your going for I so why not check to see if the y value is level with the other vertices if so then colour it one way, if its not then its a hill or cliff. One thing to check if the y heights on verts and then light them accordingly so ones facing away from light are darker. Its an old school trick to give lighting before they made things like quake etc


FBEpyon(Posted 2014) [#12]
@Kryzon

So basically I would need to calculate the normals of the quads and then rebuild the mesh with the new calculations.

@EdzUp

I will have to try this, I'm using Shaders now, I just added them last night and they seem to be working GREAT!! So I might make a procedural texture that will show the different high lights.


FBEpyon(Posted 2014) [#13]
Okay everyone; I was able to get it resolved for the most part, I wrote a new set of commands for Quads, and added two triangles for each quad, and matched the Normals to them (wrote my own normals).. Thanks for the help all..