Page 6 of 7

Re: irrRenderer 1.0

Posted: Tue Apr 07, 2015 9:18 am
by thanhle
Temporary fix for direction light. Removed sudden light switch off at singularity (dot product 90degree).

Code: Select all

uniform sampler2D ColorTex;     //guess what :P
uniform sampler2D NormalTex;    //view space normal.xy
uniform sampler2D DepthTex;    //view space depth
uniform vec3 Direction;
uniform vec3 Color;
 
void main()
{
    vec4 vNormal= texture2D(NormalTex, gl_TexCoord[0].xy);
 
    //reconstruct normal
    vNormal.xy*= 2.0;
    vNormal.xy-= 1.0;
    vNormal.z= -sqrt( -(vNormal.x*vNormal.x) - (vNormal.y*vNormal.y) + 1.0 );
    //calculate the light
    
    vec4 lightDir= vec4(normalize(Direction), 0.0);
    float NdotL = max(dot(normalize(vNormal), lightDir), 0.0);
    
    // Temp fix of the bug of the dot product at angle 90degree.
    // This is useful for Phong shade and 1/2 vector calculation.
    float rim = pow(1.0 - NdotL, 4.0); //Use the power constant 2,3... //Smaller power for softer light shadow.
    vec4 Diffuse =  vec4(Color,0.0)*texture2D(ColorTex, gl_TexCoord[0].xy); 
    
    gl_FragColor= rim*Diffuse;
}
 
Ambient light shader seems to have same calculation as directional.
Why don't we merge ambient with directional? Or can we access Ambient light data inside directional light?

Regards
thanh

Re: irrRenderer 1.0

Posted: Tue Apr 07, 2015 11:31 am
by ent1ty
thanhle wrote: Why don't we merge ambient with directional?
Because you can have ambient light without directional light or multiple directional lights :) Attempting to merge ambient end directional would result in some special cases that would be painful to handle :P

Thanks, I will take a look at the bug in directional lighting as soon as I fix transparent materials.


By the by, does anyone have any advice on how to handle lighting for transparent billboards (i.e. volumetric smoke)? I think you always want t pretend that the normal faces whatever light you're currently calculating, but you also have to remember to still take the normal into account for other transparent nodes that don't rotate to face the camera. The issue I have is I'm unsure how to handle this gracefully in shaders.

Re: irrRenderer 1.0

Posted: Tue Apr 07, 2015 1:29 pm
by thanhle
Another way to fix the light flashing issue.
Different way of calculating the normal. Maybe we need a better way to calculate the normal.

Code: Select all

 
uniform sampler2D ColorTex;     //guess what :P
uniform sampler2D NormalTex;    //view space normal.xy
uniform sampler2D DepthTex;    //view space depth
uniform vec3 Direction;
uniform vec3 Color;
 
void main()
{
 // Get normal from texture
    vec4 vNormal = normalize((texture2D( NormalTex, gl_TexCoord[0].xy) * 2) - 1);
        
    vec4 lightDir= vec4(-normalize(Direction), 0.0);
    float NdotL = max(dot(vNormal, lightDir), 0.0);
    
      vec4 color = vec4(0);
    if(NdotL > 0) {
     vec4 Diffuse =  vec4(Color,0.0)*texture2D(ColorTex, gl_TexCoord[0].xy); 
    color+=  NdotL*Diffuse;
 
    }
    
    gl_FragColor = color;
}

Re: irrRenderer 1.0

Posted: Thu Apr 09, 2015 10:13 pm
by CuteAlien
Might be Irrlicht also needs another change - I just noticed latest change broke tests which it shouldn't have broken. But need some more time to investigate what's going on.

Re: irrRenderer 1.0

Posted: Tue Jul 07, 2015 3:49 pm
by The_Glitch
I'd like to look into this project for use. I have a few questions though.

1). Will this work with shader pipeline?
2). I've been developing RNM for Irrlicht and is the lighting solution I currently use, I've read the deferred rendering basically made my solution deprecated lol.
3). Will this work on windows currently?

Re: irrRenderer 1.0

Posted: Tue Jul 07, 2015 6:11 pm
by christianclavet
Hi, If you mean RNM are directionnal Lightmaps, I've found this on the Unity site and there no mention that it's can be used in deferred rendering.
http://docs.unity3d.com/Manual/Lightmap ... ional.html

Re: irrRenderer 1.0

Posted: Tue Jul 07, 2015 6:46 pm
by The_Glitch
What I meant in question 2 is would deferred rendering be better for me as I'm kinda tired of lightmaps. I don't care if I can't use them anymore just wondering if it's a good replacement.

Re: irrRenderer 1.0

Posted: Wed Jul 08, 2015 3:49 pm
by christianclavet
Deffered rendering won't do any shadow. You need lightmaps to do that.

The deferred shading will be able to render tons of lights, will give a much better performances on lighting than forward rendering, But the shadowing (shadow that is casted from the object must be rendered via lightmaps)
Look here: http://gamedevelopment.tutsplus.com/art ... edev-12342

Re: irrRenderer 1.0

Posted: Fri Jul 10, 2015 7:49 pm
by The_Glitch
Is the any projects or solutions so I can compile this on windows?

Re: irrRenderer 1.0

Posted: Sat Jul 11, 2015 2:38 pm
by ent1ty
I think you can either use the makefile with mingw make or the Code Blocks project.

Re: irrRenderer 1.0

Posted: Fri Oct 23, 2015 8:19 pm
by Jibreel Yahya
Hi, guys.
The irrRenderer compiles and works fine, but I had a problems with irrPP. I'm using Visual C++ 2015 with Irrlicht 1.9 from SVN:
The compilation works fine, but the execution results in 'Access violation reading location 0x00000000' in the file 'CPostProcessingEffectChain.cpp', in the function 'readShader'.
Here occurs the breakpoint: irr::u32 size = file->getSize();
I tested previous Visual C++ versions and previous Irrlicht versions, but occur the same error.

Sorry my poor English. :D

Some idea ?

Re: irrRenderer 1.0

Posted: Fri Oct 23, 2015 11:51 pm
by devsh
You can use cascaded fract() wrapped 3d volume signed distance clip-maps with opacity to cone-trace your shadows (with transparency and even color if you're willing to splash 75-50% more memory)

We'll be going in that direction as we have way to many triangles and transparent geometry to justify rendering a shadowmap

Re: irrRenderer 1.0

Posted: Sat Oct 24, 2015 12:45 am
by mongoose7
@JibreelYahya: Maybe it couldn't find the shader. Check your filepaths. Also, run the code from the location where it is meant to be run. You probably ran it in the IDE and the location was not correct.

Re: irrRenderer 1.0

Posted: Wed Oct 28, 2015 10:21 pm
by Jibreel Yahya
@mongoose7: Thank you. The path for shaders was wrong.

Re: irrRenderer 1.0

Posted: Thu Oct 29, 2015 8:45 am
by AReichl
When i checkout with GIT or SVN i get different sources ( specially regarding "irrPP" ).
So - which is the "right" one?