Horde3D

Next-Generation Graphics Engine
It is currently 20.10.2019, 22:21

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 25.07.2019, 11:58 
Offline

Joined: 25.07.2019, 11:18
Posts: 2
Newbie here needing help. Game engine I'm modding uses slightly older version of Horde.
Code:
<Pipeline name="FOW">
   <Setup>
      <GlobalRenderTarget id="FogOfWarRT" />
   </Setup>
   <CommandQueue>
      <Stage id="FogOfWar_RT">
         <SwitchTarget target="FogOfWarRT" />
         <ClearTarget colBuf0="true" depthBuf="true"/>
         <DrawGeometry scene="0" context="HEIGHT" forceLodLevel="0" cached="false"/>
         <DrawGeometry context="FOW_RT_EXPLORED" forceLodLevel="0" cached="false"/>
         <DrawGeometry context="FOW_RT_VISIBLE" forceLodLevel="0" cached="false"/>
      </Stage>
   </CommandQueue>
</Pipeline>


The thing is I'd like to perform channel multiplying (green *= red) after all DrawGeometry calls are finished (i.e. post-process the target) then do a Gaussian blur on the alpha channel. How do I perform such operations (without geometry calls) on a current render target?


Top
 Profile  
Reply with quote  
PostPosted: 25.07.2019, 20:06 
Offline

Joined: 17.11.2009, 17:00
Posts: 197
Location: Russia, Moscow
Hello. You can check the hdr pipeline, it has exactly the steps that you want.
It would probably look something like that:
Code:
<RenderTarget id="PostProcBuf" depthBuf="false" numColBufs="1" format="RGBA8" />
...
 <Stage id="FogOfWar_RT">
         <SwitchTarget target="FogOfWarRT" />
         <ClearTarget colBuf0="true" depthBuf="true"/>
         <DrawGeometry scene="0" context="HEIGHT" forceLodLevel="0" cached="false"/>
         <DrawGeometry context="FOW_RT_EXPLORED" forceLodLevel="0" cached="false"/>
         <DrawGeometry context="FOW_RT_VISIBLE" forceLodLevel="0" cached="false"/>
      </Stage>
<Stage id="PostProcess">
   <SwitchTarget target="PostProcBuf" />
   <BindBuffer sampler="buf0" sourceRT="FogOfWarRT" bufIndex="0" />
   <DrawQuad material="pipelines/postProc.material.xml" context="POSTPROCESSING" />
   <UnbindBuffers />
</Stage>
<Stage id="Combination">
   <SwitchTarget target="" />
   <BindBuffer sampler="buf0" sourceRT="PostProcBuf" bufIndex="0" />
   <DrawQuad material="pipelines/final.material.xml" context="FINALPASS" />
   <UnbindBuffers />
</Stage>


So, you would have to create a material that references the shader that would be called. The shader should contain the POSTPROCESSING context. You can check the postHDR.shader to see how it is done.
Please note that the code above is not tested but should be pretty close to reality.


Top
 Profile  
Reply with quote  
PostPosted: 26.07.2019, 10:35 
Offline

Joined: 25.07.2019, 11:18
Posts: 2
Thanks.

Now my next question is: do I need two more stages if I want to skip the blur and do just G *= R? In case of an image processing such a filter doesn't rely on the whole result, can be applied per pixel as all information is held by that pixel so no cached copy is required to probe pixels from.


Top
 Profile  
Reply with quote  
PostPosted: 26.07.2019, 12:00 
Offline

Joined: 17.11.2009, 17:00
Posts: 197
Location: Russia, Moscow
You would probably have a pipeline stage for blur, like I've shown for post-processing. You can disable the blur pipeline stage when needed from horde's api and just use the post-processing one that is the next stage (I guess that you have 3-4 stages - geometry, blur, post-processing, combination (optional, can be merged with post processing stage)).
It should be something like that:
Code:
h3dSetResParamI( pipelineRes, H3DPipeRes::StageElem, stageInPipelineIndex, H3DPipeRes::StageActivationI, 0 );


Please note: if you are going to use several cameras, do not use the same pipeline resource for several cameras simultaneously. It seems that currently it is not supported. You should create a clone of pipeline resource if needed.


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

All times are UTC + 1 hour


Who is online

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