Horde3D

Next-Generation Graphics Engine
It is currently 28.04.2024, 09:16

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 14.09.2009, 15:57 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
I've just been thinking that I could use a multi-pass shader for my highlight selection. Only, I'm not sure H3D supports multi-pass materials. Does it?


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2009, 19:43 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I was thinking about adding passes to the FX files before. The passes are a leftover from the days where the GPUs were extremely limited in the instruction count and resource bindings so that you had to do several passes to realize a more complex effect. This is not the case any more these days, so the passes are a lot less essential. However, I understand that in some rare cases they may be useful or just convenient. Hmm, supporting them would not really be a problem. It is just that they are not so efficient since you always switch states for a single object. This could be optimized of course but would make things like sorting by state more complicated.

You can do a more global form of multi-passing with the pipeline scripts. You can draw geometry of a specific class with a specific shader context. For example, for highlighting selcted objects, you could add another DrawGeometry call which will just draw objects with the material class "highlighted" with a special additive shader that renders the objects for example in red. This can be a bit more efficient than the naive per-object pass method since objects are grouped together when doing the passes.


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2009, 20:11 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
I'm still not 100% sure I quite understand exactly how shaders are bound to render passes. In terms of shader definitions etc. Especially the idea of contexts confuses the issue.

Maybe you could document some examples of simple shaders and how to get unique render styles in the wiki so that we can follow the workflow a bit easier?

For instance, I'm writing an additive alpha shader for some highlight selection stuff. So I add an alpha.shader file, with a translucent context. As far as I can tell, as long as my scene material uses this material which references my alpha shader, it should work, only it doesnt :)

I'm sure I'm just missing something silly or a definition somewhere, but having a checklist of how to get a new shader working would really help out there.


Top
 Profile  
Reply with quote  
PostPosted: 15.09.2009, 01:50 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
marciano wrote:
The passes are a leftover from the days where the GPUs were extremely limited in the instruction count and resource bindings so that you had to do several passes to realize a more complex effect.
Passes can still be useful for simplifying the "combinations of shaders" problem.

For example, if you've got at effect that has 3 passes, and each of those passes can run 3 different shaders.
In a system with multi-pass materials, you only have 3 shaders, but if restricted to a single pass, you've got to have 9 shaders.

As you suggest, this might be possible to implement using pipelines (and also more efficient). I haven't experimented with this enough to know if pipelines are enough, or if passes would be required within an FX file...


Top
 Profile  
Reply with quote  
PostPosted: 15.09.2009, 21:03 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
zoombapup wrote:
I'm still not 100% sure I quite understand exactly how shaders are bound to render passes. In terms of shader definitions etc. Especially the idea of contexts confuses the issue.

Maybe you could document some examples of simple shaders and how to get unique render styles in the wiki so that we can follow the workflow a bit easier?


Ok, I will try to explain the pipeline system a bit more in detail later this week (probably weekend).


Top
 Profile  
Reply with quote  
PostPosted: 16.09.2009, 07:28 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
DarkAngel wrote:
Passes can still be useful for simplifying the "combinations of shaders" problem.

That is a good point. However, breaking up an effect into different passes will usually be slower (additional vertex processing and bandwidth for each pass, maybe re-sampling of a few textures, etc.). Horde's übershader system makes handling the permutations relatively convenient for the programmer. A good example for reducing shader complexity by performing orthogonal steps are deferred techniques. These are handled very well by Horde's pipeline system.

DarkAngel wrote:
As you suggest, this might be possible to implement using pipelines (and also more efficient). I haven't experimented with this enough to know if pipelines are enough, or if passes would be required within an FX file...

In general the pipeline system should allow to do most common effects. However, there may be some very special effects that can be realized in a cleaner way with the local FX passes. Well, if it turns out that FX passes are convenient, nothing stops us from adding them.


Top
 Profile  
Reply with quote  
PostPosted: 20.09.2009, 13:46 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
As promised, I have started a wiki page which explains the pipeline basics:

http://horde3d.org/wiki/index.php5?title=The_Flexible_Rendering_Pipeline

Let me know when anything is unclear and everyone, feel free to extend, correct or clarify that article :)

I also saw that there is another pipeline tutorial by Mikmacer in the tutorials section.


Top
 Profile  
Reply with quote  
PostPosted: 20.09.2009, 15:42 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Nice one. I think the old tutorial version is out of date.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 15 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