About Store Forum Documentation Contact



Post Reply 
Flat shading for dynamic created mesh
Author Message
Pherael Offline
Member

Post: #1
Flat shading for dynamic created mesh
As in topic, in game I'm creating dynamic roof, but I don't know how change shading from smooth to flat. No matter what I try it's look like on screen.

[Image: uc?export=download&id=0B2UJDG_6H...0xQc0pXT2s]

Is there any in engine way, or only option is calculate them myself? (And since I'm not sure how, maybe somebody can help me with this?)
01-23-2017 10:59 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Flat shading for dynamic created mesh
You could try 2 things:

1) remove mesh vtx normals manually in code, and work with material ambient light, or SetHighlight function

or

2) use "Blend" shader (not "Blend Light"), and just set the material color

I think #2 is simpler
01-24-2017 05:27 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: Flat shading for dynamic created mesh
Can't you just properly set the normals for each unique rooftile?
01-24-2017 10:33 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Flat shading for dynamic created mesh
Yes, this is option 3)

MeshBase mesh;
mesh.exclude(VTX_DUP);
mesh.explodeVtxs();
mesh.setNormals();

if having Mesh mesh;
then do first:
mesh.setBase();
MeshBase &base=mesh.parts[i].base;
base.... (as above)
mesh.setRender();
mesh.delBase();
01-24-2017 11:59 AM
Find all posts by this user Quote this message in a reply
Pherael Offline
Member

Post: #5
RE: Flat shading for dynamic created mesh
Thanks for help smile it seems that explodeVtxs() is what I needed.
01-24-2017 12:09 PM
Find all posts by this user Quote this message in a reply
Post Reply