JF_Aidan_Pryde
Regular
Scali said:1. How does the engine know a particular polygon or fragment belongs to a tree?
The engine will render the scene one object at a time (or actually one mesh at a time). Something like Draw( tree );
The tree object will contain all the polygons and some kind of description of the surface (texture, material properties etc).
2. Once it does know, and it needs to build some leaf shaders 'from scratch', how does it know the visual characteristics of foliage? Where does it get the info on ambient, diffusse and specular for example?
Those are stored in some way with each object, as stated before.
So there is some kind of 'recipe' from which the engine can dynamically create a shader.
For example, the object could contain a set of properties like this:
ambient: 0, 1, 1
diffuse: 1, 1, 1
specular: 0.5, 0.5, 1
shininess: 16
reflection: no
cast shadow: yes
texture: tree.jpg
bump: treebump.jpg
Then the engine has a list of active lights, and if you combine the two, you should know everything you want to know for your lighting model.
Thanks Scali, that makes sense now.
How much effects can a set of default ingredience generate? With just ambient, diffuse, specular, textures etc. one can get most surfaces, but what about water, gas or exotic materials? How would it' handle something like a Fresnel shader or subsurface scatter?