Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Shader arhitecture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Papadopol   Members   -  Reputation: 178

Like
0Likes
Like

Posted 05 September 2012 - 01:51 AM

Hello. A n00b question about shaders,devices and other elements in DirectX 11.

I'm using simple shaders to create some effects but the code got a litle ugly because I dont have a framework. I dont want something fancy I just want something that will help me in the future when I'll create more complex shaders that require additional parameters and state changes etc.

So My idea was:

Create a DEVICE class that has only the initiation of DirectX 11 data.
Create a SHADER class that will initiate with an DEVICE objects that contains d3d11device, context, render target etc.
Create a GRAPHIC class that again will initiate with DEVICE and SHADER objects and render all the geometry.

Device.init(1920,1200, etc..
Shader.init(Device etc..
Graphic.Init(device, shader, input etc..)

Is this a decent framework for a simple project or should I try a different approach ?

Thanks.

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 8001

Like
0Likes
Like

Posted 05 September 2012 - 02:25 AM

Create a GRAPHIC class that again will initiate with DEVICE and SHADER objects and render all the geometry.

This is somewhat of a missconception. You will need lot of shaders. Shaders are in a way similar to textures, that is you need different shaders for different models and effects (both effect the rendering of a surface).
This was a missinterpretation of me, I read single Shader, but you mean already a collection of different shaders.

I have a material class which contains one or more shaders (depends on rendering pass). This material class will be assigned to certain models, that is all.

Edited by Ashaman73, 05 September 2012 - 04:53 AM.


#3 Papadopol   Members   -  Reputation: 178

Like
0Likes
Like

Posted 05 September 2012 - 03:38 AM

I was thinking about state changes and other CPU operations that will make the shader class reliable instead of just loading some shader files like textures. Also the framework strucutre is ok even if I dont complicate the things with shader ? I mean for everything else, like initiating objects with other objects and so on.

#4 Ashaman73   Crossbones+   -  Reputation: 8001

Like
0Likes
Like

Posted 05 September 2012 - 04:59 AM

I was thinking about state changes and other CPU operations that will make the shader class reliable instead of just loading some shader files like textures. Also the framework strucutre is ok even if I dont complicate the things with shader ? I mean for everything else, like initiating objects with other objects and so on.

You have not much of a framework yet. Here are more details about my approach, at least it works for me:

Model
-> vertices,tris etc.
-> Model Textur data
-> Material
Material
-> State (zbuffer, blending etc)
-> Shader
-> Material Texture Data
-> Mapping

The Mapping links parameter, textures etc. to shader parameters:
Model_Texture_0 -> Shader:tex_unit_0
Material_Texture_Shadomap -> Shader:tex_unit_1





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS