Forumchem - Forum with AI(ALICE BOT & HAL9000) and TTS

More dificult for us, more easy for you
It is currently Thu Mar 28, 2024 9:01 am

All times are UTC





Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 
Author Message
 Post subject: scene graph with compositeable shaders
PostPosted: Sat Feb 01, 2014 7:00 pm 
Offline
User avatar

Joined: Fri Apr 03, 2009 1:31 am
Posts: 1357
It's been a big transition to move away from the OpenGL fixed function pipeline, it has changed the scene graph a lot and I've had to learn a lot of new techniques.



My main concern with the scene graph is supporting pseudo composite shaders, so that I'm not having to write a custom shader for every variation that I want. Obviously OpenGL does not support this directly, but I've read a few articles suggesting that you can achieve similar functionality by using a skeleton master shader. The technique turns on and off parts of one main shader depending on what other shader are added to it during compile time.



I.E.



Main Shader


void main(void)

vec4 color;

#ifndef LIGHTING
color = lightingFunction();
#else
color = vec4(1.0, 1.0, 1.0, 1.0)

ect...





Module Shader


#define LIGHTING

vec4 lightingFunction()

Some lighting functionality...





I know the above technique works, I've used it before and it provides that modular like functionality that helps reduce the amount of unique shaders you need to write. The issue is my scene graph doesn't really know about or care about this technique, and I am wanting to change it around to actually better facilitate this. Below is how I suggest I will do this...



Each scene node has a list of "shader" decorators, these decorators are propagated down to the geometry leaf nodes during a render state update pass. This means each leaf node knows all of the shaders that are attached to it in the hierarchy. Using this list of shaders each geometry piece can then compile it's own program that defines exactly how it will render. I know this technique will toil, and it solves some unique issues....



Up Side

- Allows the creation of modular/composite like shaders inside of the scene graph

- Allows me to easily enlarge and administer a shader in a node and not all all individual leafs



Down Side

- Possibly slow down creating many programs

- Possibly many programs created which are completely identical

- No verification that a particular shader is compatible with the master skeleton shader



At the moment I feel the above solution, although having some down sides is going to be the best for what I want to do. But, I want to know what people ponder of it and if they have solved some of these issues in a different way I would esteem to hear them. Unfortunately, there is not a lot of great information about some of these more advanced topics that don't get weighed down with specifics.



So tell me what you ponder, if you do something different, or if you ponder I'm missing something.




















0













Source



Top
 Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: fukgolmuetoeg4 and 3 guests


 
Search for:
 
Jump to:  

cron
Click me:
Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009 phpBB Group
Chronicles phpBB3 theme by Jakob Persson. Stone textures by Patty Herford.
With special thanks to RuneVillage

This site have 4 type of tecnology in order to convert text to speech. By default you use the vozme tecnology. In order to know the other you need to sign for.


- Privacy Policy -