Horde3D
http://horde3d.org/forums/

Ambient, Diffuse, Emissive, Specular settings for models
http://horde3d.org/forums/viewtopic.php?f=2&t=956
Page 1 of 1

Author:  craigomatic [ 24.09.2009, 13:11 ]
Post subject:  Ambient, Diffuse, Emissive, Specular settings for models

Hi all,

I'm porting across to Horde from a DirectX fixed function renderer where previously we've had access to ambient, diffuse, emissive and specular colour values on a per material (group) basis.

I'm looking to emulate these material settings in Horde by modifying model.shader and am wondering how I go about passing variables into that particular shader?

From the documentation it mentions:
Quote:
Horde3D materials are acting as the glue between a shader and the uniform data. The material resource references a shader for which it binds texture images. Furthermore, it enables to define arbitrarily named vector uniforms that can be used to exchange data between the application and the shader

...but I'm having a little trouble joining the dots.

Can anyone help me out with an example? Am I on the right track?

Author:  Volker [ 24.09.2009, 16:10 ]
Post subject:  Re: Ambient, Diffuse, Emissive, Specular settings for models

I guess you are searching for h3dSetMaterialUniform?

Author:  marciano [ 24.09.2009, 19:27 ]
Post subject:  Re: Ambient, Diffuse, Emissive, Specular settings for models

Do you want to have a single color value or a texture for the different lighting components (e.g. for specular)?

Author:  craigomatic [ 26.09.2009, 11:46 ]
Post subject:  Re: Ambient, Diffuse, Emissive, Specular settings for models

I'm just wanting to be able to set a single colour value for each of ambient, diffuse, etc.

To use h3dSetMaterialUniform do I need to define anything in the XML or can I just create the uniform variables in the shader?

Author:  marciano [ 27.09.2009, 21:28 ]
Post subject:  Re: Ambient, Diffuse, Emissive, Specular settings for models

Take a look at the specParams uniform in the model shader. It shows how uniform parameters can be used. You just need to declare a uniform in the shader FX section and then you can use it in the shader code. The uniform value can be set either either with h3dSetMaterialUniform or directly in a material file (see material format documentation).

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/