Horde3D http://www.horde3d.org/forums/ |
|
Pipelines/Shaders/Materials - Help - I just want a window! http://www.horde3d.org/forums/viewtopic.php?f=2&t=657 |
Page 1 of 1 |
Author: | tihare [ 24.02.2009, 05:35 ] |
Post subject: | Pipelines/Shaders/Materials - Help - I just want a window! |
First of all, I have followed this engine's development over the years, and I have always been a fan ![]() 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 |
Author: | marciano [ 24.02.2009, 22:17 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
I think you need to get a bit more concrete if you expect help ![]() |
Author: | tihare [ 25.02.2009, 02:27 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
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. |
Author: | swiftcoder [ 25.02.2009, 02:48 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
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.
|
Author: | tihare [ 25.02.2009, 04:18 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
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. |
Author: | DarkAngel [ 25.02.2009, 05:11 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
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" /> |
Author: | tihare [ 25.02.2009, 06:09 ] |
Post subject: | Re: Pipelines/Shaders/Materials - Help - I just want a window! |
You made my day, thanks a ton ![]() |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |