Horde3D

Next-Generation Graphics Engine
It is currently 01.11.2024, 01:09

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: 21.08.2009, 14:04 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Hey all.

Ok, another issue has come up. Specifically, how to get baked ambient occlusion into the engine.

As far as I can tell, there is support for a second set of UV's?

So its mainly a shader issue. Just adding another sampler for the lightmap, then making sure that the lightmap texture is multiplied with the diffuse properly. It seems reasonably simple, apart from a couple of issues.

1) The contexts are setup in the pipeline file right? Then it uses those contexts to define which VS/FS shaders are active for that geometry pass?

2) The ambient context would seem to be the most obvious place to add an ambient occlusion map. So my thinking is to add another flag (F06_Lightmap) and add another sampler there for the lightmap.

Hmm, I see now how the contexts work with the pipeline files. Thats good.


Top
 Profile  
Reply with quote  
PostPosted: 22.08.2009, 00:15 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
The way you want to use the ambient occlusion maps sounds right.

zoombapup wrote:
1) The contexts are setup in the pipeline file right? Then it uses those contexts to define which VS/FS shaders are active for that geometry pass?

Yes, contexts are referenced in the pipeline files. They are declared and defined in the shader files.

zoombapup wrote:
2) The ambient context would seem to be the most obvious place to add an ambient occlusion map. So my thinking is to add another flag (F06_Lightmap) and add another sampler there for the lightmap.

Yep!


Top
 Profile  
Reply with quote  
PostPosted: 22.08.2009, 09:15 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Ok, another question :)

I'll need to add the second set of texcoords to pass in the VS. Is it safe to assume that two sets of UV's are always passed in the vertex stream?


Top
 Profile  
Reply with quote  
PostPosted: 22.08.2009, 19:10 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
At the moment it is safe to assume that.

In the future we may want to save some memory and not have a second set of coordinates for all geometry. This will require some special care then, either on application or on engine side (e.g. having a default stream).


Top
 Profile  
Reply with quote  
PostPosted: 22.08.2009, 21:20 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Ok, I've got the shader setup. But I'm getting some weird output, which I believe is the second set of UV coords.

I've had a look in the collada file and there does seem to be a second set of UV coords as you would expect. But they are mapped onto channel 3.

Code:
     <source id="Plane01-mesh-map-channel1">
          <float_array id="Plane01-mesh-map-channel1-array" count="264"> blaaaah </float_array>
          <technique_common>
            <accessor source="#Plane01-mesh-map-channel1-array" count="88" stride="3">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
              <param name="P" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Plane01-mesh-map-channel3">
          <float_array id="Plane01-mesh-map-channel3-array" count="648"> blaaah </float_array>
          <technique_common>
            <accessor source="#Plane01-mesh-map-channel3-array" count="216" stride="3">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
              <param name="P" type="float"/>
            </accessor>
          </technique_common>
        </source>


Obviously the blaaaah's are a long list of UV float coordinates.

I'm just wondering, how does colladaconv assign UV coords? Will it just map the first two channels? I'll have a bit of time to look at the source tommorow. But if the easy fix is for me to just assign the lightmap texture to channel 2 in max rather than channel 3, I'll do that :)


Top
 Profile  
Reply with quote  
PostPosted: 23.08.2009, 09:48 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Actually there is some logic in ColladaConv to handle exactly this. But of course it is possible that it got slightly broken over time.


Top
 Profile  
Reply with quote  
PostPosted: 23.08.2009, 17:35 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Turns out it was the wrong UV channel in Max. I changed it to channel 2 and the second texcoords worked fine.

Of course the lighting stuff is only as good as your lightmap generator. I'm going to be evaluating flatiron at some point, just to see how that goes.

Now I guess I should have a look at adding a specularity mask texture. I really need some sample scenes with the various shader combinations my artists might want though. Hmm.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 14:45 
Offline

Joined: 11.06.2008, 10:34
Posts: 119
spec shader would be good in general, or contained in an alpha channel of the texture instead of transparency.

_________________

Let's bring 'em out! Any old iron! Any old iron!
A door opens and a homewife brings out a rather sophisticated-looking ground-to-air missile system, and dumps it on the cart.
Thank you.


Top
 Profile  
Reply with quote  
PostPosted: 13.10.2009, 21:04 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Problem is my game doesnt really need any of that stuff :)

I'm going to be adding depth of field and ambient occlusion (directional AO) because my artists requested it. But I figured a spec-mask would be useful too.


Top
 Profile  
Reply with quote  
PostPosted: 14.10.2009, 08:03 
Offline

Joined: 11.06.2008, 10:34
Posts: 119
understood :) your baked AO shader so far has been working as a lightmap pass :) (okay the model is still slightly shaded but enough to give a result)

Would be good if a few extra shaders were included with H3d SDKs in general for those non-programmers.

Talking of spec, what defines the amount per surface in horde?

_________________

Let's bring 'em out! Any old iron! Any old iron!
A door opens and a homewife brings out a rather sophisticated-looking ground-to-air missile system, and dumps it on the cart.
Thank you.


Top
 Profile  
Reply with quote  
PostPosted: 14.10.2009, 18:41 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
If anyone has any specific shader requirements, I'm happy to take a look at them.

I've got a "light from god" shader to write now :) so if any arty types want to list the kind of shaders they'd find useful, maybe we can get them written and put in the trunk?

Phil.


Top
 Profile  
Reply with quote  
PostPosted: 17.10.2009, 10:33 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
zoombapup wrote:
I've got a "light from god" shader to write now :) so if any arty types want to list the kind of shaders they'd find useful, maybe we can get them written and put in the trunk?

Sounds great, we can definitely put them into the community branch. If you want to have write access to that svn repository, Volker can grant you the required user rights.


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

All times are UTC + 1 hour


Who is online

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