Horde3D

Next-Generation Graphics Engine
It is currently 30.11.2024, 01:45

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 24.09.2009, 13:11 
Offline

Joined: 18.09.2009, 07:44
Posts: 17
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?


Top
 Profile  
Reply with quote  
PostPosted: 24.09.2009, 16:10 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I guess you are searching for h3dSetMaterialUniform?


Top
 Profile  
Reply with quote  
PostPosted: 24.09.2009, 19:27 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Do you want to have a single color value or a texture for the different lighting components (e.g. for specular)?


Top
 Profile  
Reply with quote  
PostPosted: 26.09.2009, 11:46 
Offline

Joined: 18.09.2009, 07:44
Posts: 17
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?


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 21:28 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group