Horde3D

Next-Generation Graphics Engine
It is currently 25.10.2020, 20:30

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 24.02.2009, 05:35 
Offline

Joined: 08.05.2007, 07:34
Posts: 12
First of all, I have followed this engine's development over the years, and I have always been a fan :) Recently, I took it upon myself to help out someone try to land a potential gig, I looked to this Engine, I started diving back into things, and have learned a lot in a couple days, I find myself now, needing to clear one more hurdle, before I can get into the clear.

I'm familiar with Deferred rending, and troubles that arise with alpha channels, and Anti-Aliasing, generally in the past, I would just draw these in a pass outside the main Deferred loop, the downside of course, is no lighting, it's a trade-off I'm willing to live with. So I have my sample scene loaded, and with some simple geometry, a new character, and some clipmaps, ironically the clip-maps appear to work, I wish I knew a way to adjust the alpharef, as the clips seem very harsh, almost to a 1bit level. I'm ok generally with the look of this for now, all is going well, and I have a table that I want to be transparent, via the alpha channel, 50% or whatever, as well as a water surface. I'm a bit puzzled why the table surface, isn't working 100% opaque, where as the clips are working, I'm guessing there are some alpha-blend states someplace, but I really don't know where to look. I'll keep digging, as my time frame slowing begins to close, I'm seeking help in anyway possible.

Thanks


Top
 Profile  
Reply with quote  
PostPosted: 24.02.2009, 22:17 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I think you need to get a bit more concrete if you expect help :)


Top
 Profile  
Reply with quote  
PostPosted: 25.02.2009, 02:27 
Offline

Joined: 08.05.2007, 07:34
Posts: 12
I'm crashing through this engine trying to learn as much as I can, so I can support the artist I'm working with. I got some art from him, a world which, I exported with Collada(shocker), and later managed to get it into the editor, and get it into the engine, everything seems to work, I have a couple minor issues in regards to clip-mapped alpha for tree's, shrubs, etc(not too worried). The one issue I can't seem to solve is I can't get a flat alpha'd plane to display, such that you can see through(like a window).

Currently I'm using the forward pipeline, I created a new shader, and applied it via the editor, I'm able to see results, say if I assign a flat color to the shader, say in the ambient pass. Since the Ambient pass is the initial pass, I wanted to wait until later on(until everything was drawn) draw a TRANSLUCENT pass, with just the alpha stuff. Now to my question:

1. What determines, or how do I set things(max/material), so they get drawn in the TRANSLUCENT pass of the shader?


Again, I'm trying to draw a window/glass table with alpha.


Top
 Profile  
Reply with quote  
PostPosted: 25.02.2009, 02:48 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
tihare wrote:
1. What determines, or how do I set things(max/material), so they get drawn in the TRANSLUCENT pass of the shader?
Use a shader with only a TRANSLUCENT pass. Whatever passes are present in the shader, will be run when the matching pass is drawn in the pipeline config.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 25.02.2009, 04:18 
Offline

Joined: 08.05.2007, 07:34
Posts: 12
swiftcoder wrote:
tihare wrote:
1. What determines, or how do I set things(max/material), so they get drawn in the TRANSLUCENT pass of the shader?
Use a shader with only a TRANSLUCENT pass. Whatever passes are present in the shader, will be run when the matching pass is drawn in the pipeline config.



Thanks for the reply, I did try this, and it doesn't seem to be executing my Context("TRANSLUCENT");

Code:
<!-- Forward Shading Pipeline -->
<Pipeline>
   <CommandQueue>
      <Stage id="Geometry" link="globalSettings.material.xml">
         <ClearTarget depthBuf="true" colBuf0="true" />
         
         <DrawGeometry context="AMBIENT" class="~Translucent" />
         <DoForwardLightLoop class="~Translucent" />
         
         <DrawGeometry context="TRANSLUCENT" class="Translucent" />
      </Stage>
      
      <Stage id="Overlays">
         <DrawOverlays context="OVERLAY" />
      </Stage>
   </CommandQueue>
</Pipeline>

<Shader>
  <Context id="TRANSLUCENT">
     <VertexShader>
      <InsCode code="utilityLib/vertCommon.glsl" />
      <DefCode>
        <![CDATA[
            uniform vec3 viewer;
            attribute vec2 texCoords0;
            attribute vec3 normal;
            varying vec3 tsbNormal;
            varying vec4 pos, vsPos;
            varying vec2 texCoords;
         
            void main( void )
            {
               // Calculate normal
               tsbNormal = calcWorldVec( normal );
            
               // Calculate world and view space positions
               pos = calcWorldPos( gl_Vertex );
               vsPos = calcViewPos( pos );
               
               // Calculate texture coordinates and clip space position
               texCoords = texCoords0;
               gl_Position = gl_ModelViewProjectionMatrix * pos;
            }
         ]]>
      </DefCode>
    </VertexShader>

    <FragmentShader>
      <InsCode code="utilityLib/fragLighting.glsl" />
      <DefCode>
        <![CDATA[
            uniform sampler2D tex0;
            varying vec3 tsbNormal;
            varying vec4 pos, vsPos;
            varying vec2 texCoords;
            
            void main( void )
            {
               vec4 albedo = texture2D( tex0, texCoords );
                 //if( albedo.a < 0.5 ) discard;
               
                 gl_FragColor.r = 1.0;
            }
         ]]>
      </DefCode>
    </FragmentShader>
  </Context>
</Shader>


Obviously this isn't finalized, just want to make sure this is working before I continue, I figured I would at least see the the objects mapped with the shader, but I don't see them.


Top
 Profile  
Reply with quote  
PostPosted: 25.02.2009, 05:11 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
tihare wrote:
IWhat determines, or how do I set things, so they get drawn in the TRANSLUCENT pass of the shader?
...it doesn't seem to be executing my Context("TRANSLUCENT");

In the pipeline, the line instructing Horde to render TRANSLUCENT objects also specifies a material class:
<DrawGeometry context="TRANSLUCENT" class="Translucent" />

This means your material also needs to specify the right class. The start of your material file should look like:
<Material class="Translucent">


[EDIT]
Also note that the pipeline instructions for the AMBIENT and LIGHTING passes exclude the "Translucent" material class:
<DrawGeometry context="AMBIENT" class="~Translucent" />
<DoForwardLightLoop class="~Translucent" />


Top
 Profile  
Reply with quote  
PostPosted: 25.02.2009, 06:09 
Offline

Joined: 08.05.2007, 07:34
Posts: 12
You made my day, thanks a ton :) I can't believe I overlooked that.


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

All times are UTC + 1 hour


Who is online

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