irrRenderer 1.0

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: irrRenderer 1.0

Post 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
Last edited by thanhle on Tue Apr 07, 2015 12:01 pm, edited 1 time in total.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: irrRenderer 1.0

Post 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.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: irrRenderer 1.0

Post 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;
}
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: irrRenderer 1.0

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: irrRenderer 1.0

Post 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?
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: irrRenderer 1.0

Post 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
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: irrRenderer 1.0

Post 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.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: irrRenderer 1.0

Post 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
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: irrRenderer 1.0

Post by The_Glitch »

Is the any projects or solutions so I can compile this on windows?
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: irrRenderer 1.0

Post by ent1ty »

I think you can either use the makefile with mingw make or the Code Blocks project.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
Jibreel Yahya
Posts: 10
Joined: Fri Oct 23, 2015 7:59 pm

Re: irrRenderer 1.0

Post 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 ?
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: irrRenderer 1.0

Post 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
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: irrRenderer 1.0

Post 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.
Jibreel Yahya
Posts: 10
Joined: Fri Oct 23, 2015 7:59 pm

Re: irrRenderer 1.0

Post by Jibreel Yahya »

@mongoose7: Thank you. The path for shaders was wrong.
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: irrRenderer 1.0

Post by AReichl »

When i checkout with GIT or SVN i get different sources ( specially regarding "irrPP" ).
So - which is the "right" one?
Post Reply