Horde3D
http://horde3d.org/forums/

Updating the Fresnel Shader
http://horde3d.org/forums/viewtopic.php?f=2&t=1005
Page 1 of 1

Author:  Hannofcart [ 10.11.2009, 09:50 ]
Post subject:  Updating the Fresnel Shader

I am trying to use the shader described in the Wiki to make a glass-like material. Now, as I understand it, the link provided in the download section is in the old XML format and I did some minor formatting to bring it up to speed with the new format. So, the current version I am using is as found here.

The shader seems to be compiling fine (atleast, the html log does not indicate anything to the contrary.) In any case it would be nice if someone could take a glance and see if things are in order. Despite enabling H3DOptions::DumpFailedShaders, I don't get a separate log txt file generated, even when I intentionally introduce typos in the GLSL code to force errors (this registers on the HTML log however). So firstly, I'd like to know what this might be due to.

In any case, the model (a simple sphere) does not render AT ALL. Hence this post. I have tried using the forward rendering pipeline as well as the deferred rendering pipeline. As I understand it, the forward rendering pipeline definition that comes with the example only defines ambient and transparent contexts and will draw only those objects with ambient/transparent contexts in the shaders referenced by their material definitions. The fresnel shader used currently defines ambient, shadowmap, attrib and lighting contexts which come into play only when deferred shading mode is used. Is this correct? I haven't set any class in the model's material definition. I reckoned that this shader seems to define an ambient, attrib and shadow passes for whatever reason and might not need me to filter it out into translucent etc. Please tell me if I am missing anything.

Code:
<Material>
   <Shader source="shaders/fresnel.shader" />

   <Sampler name="tex0" map="models/skybox/skybox.dds" />
</Material>

Author:  marciano [ 23.11.2009, 00:38 ]
Post subject:  Re: Updating the Fresnel Shader

Sorry, the reply might be a bit too late for you but anyway...

Hannofcart wrote:
Despite enabling H3DOptions::DumpFailedShaders, I don't get a separate log txt file generated, even when I intentionally introduce typos in the GLSL code to force errors (this registers on the HTML log however). So firstly, I'd like to know what this might be due to.

I did a quick test and it is working as expected for me. The files which are output are called "shdDumpVS.txt" and "shdDumpFS.txt".

Hannofcart wrote:
In any case, the model (a simple sphere) does not render AT ALL. Hence this post. I have tried using the forward rendering pipeline as well as the deferred rendering pipeline. As I understand it, the forward rendering pipeline definition that comes with the example only defines ambient and transparent contexts and will draw only those objects with ambient/transparent contexts in the shaders referenced by their material definitions.

This is right. However, the LIGHTING and SHADOWMAP (if you use shadows) contexts are required as well in the forward pipeline. The context names are defined as properties of the light node. ATTRIB is the only context used exclusively by the deferred pipeline.

When an object is not visible at all with a new shader, I usually try to reduce the shader to a minimum (e.g. just outputting a red color in the ambient pass) and then I incrementally add the additional features, always testing the steps. Usually this makes it pretty easy and quick to locate a problem.

Author:  craigomatic [ 01.02.2010, 00:15 ]
Post subject:  Re: Updating the Fresnel Shader

I seem to have a similar issue with the code pasted by Hannofcart, my log shows:

Code:
Shader resource 'shaders/fresnel.shader': FX: unexpected token (line 4)

If I enable dumpfailedshaders, shdDumpVS.txt and shdDumpFS.txt fail to appear.

I wonder if this is because I'm handing the loading of my assets from memory rather than using LoadResourcesFromDisk?

Attachments:
fresnel.txt [5.77 KiB]
Downloaded 752 times

Author:  marciano [ 01.02.2010, 02:47 ]
Post subject:  Re: Updating the Fresnel Shader

Hmm, since I could not reproduce this last time, could you set a breakpoint in egShader.cpp where dumpFailedShaders is handled to see what is going wrong?
By debugging into the parser, it would be easy as well to find out why you get an error in the FX section (might be a horde bug).

Author:  craigomatic [ 02.02.2010, 03:52 ]
Post subject:  Re: Updating the Fresnel Shader

The log error was my mistake, rather than sampler2D I had sampler. For completeness, the fixed shader is attached.

Unfortunately, I'm still unable to see the object the shader is applied to. I'll follow your advice marciano and see if I can work out the problem.

Attachments:
fresnel.txt [5.76 KiB]
Downloaded 793 times

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/