Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Wh0p

Member Since 22 Aug 2011
Offline Last Active Jan 03 2015 11:24 AM

Posts I've Made

In Topic: Stencil Clear doesn't work

03 January 2015 - 11:25 AM

 

Try adding glStencilMask(0xff) before your glClear call.

If nothing else happend this should be initialized to 0xFF...

glGetIntegerv (GL_STENCIL_CLEAR_VALUE..)?

If you are clearing a FBO's stencil buffer you might as well try out glClearBufferiv (GL_DEPTH_STENCIL, buf, depth, stencil) and see what happens.


In Topic: scene graph render order

03 January 2015 - 08:12 AM

Nice, that's sufficient for a start. I guess I can be creative on this one - like doing things in parallel.


In Topic: scene graph render order

03 January 2015 - 07:33 AM

Thanks! This is very appreciated.

I guess I expressed myself not quite accuratly by mentioning the term scene graph (I know what this is and only mentioned it because I'm calculating buckets for my objects while traversing and updating) I just wondered about the priorities...

 

@L. Spiro: Are there any further sources you can recommend on how to exploit the temporal coherence? That sounded very promising and interesting to try out.


In Topic: Texture issue with different PC's

01 January 2015 - 03:05 PM

First of all I would suggest to define your transformation matrices as uniform parameters (at some point you'd have to do this anyway).

so your vertex shader might look like this:

#version 330

uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjMatrix;
uniform mat4 NormalMatrix;

in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;

out vec3 px_position;  // for lighting in viewspace
out vec3 px_normal;    // for lighting in viewspace
out vec2 px_texcoord;


void main () 
{
	// transform into viewpace
	gl_Position = ModelMatrix * vec4 (Position, 1.0);
	gl_Position = ViewMatrix * gl_Position;
	px_position = gl_Position.xyz;
        // project
	gl_Position = ProjMatrix * gl_Position;

	px_normal = (NormalMatrix * vec4 (Normal, 0.0)).xyz;
	px_texcoord = Texcoord;
}

You then want to set up the Model, View and Projection matrices in the host app (the Normal matrix is the inverse transposed of the Modelview matrix, this has something to do with scale operations are not affine transformation, for now i'd just ask you to accept it as it is or check out the math biggrin.png)

If you do not want to implement lighting in your fragment shader feel free to omit the normals for now...

 

I'd reccomend you to check out this tutorial for how to set up your matrices correctly:

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

 

Either way scaling is an operation you are performing in object space, which yields that it is part of your Modelmatrix.

 

 

They must be loaded from a file

 

 

That is harsh but I like it biggrin.png

Doing this also yields the advantage of code completion and syntax highlighting. fyi: I once made the super include for glsl syntax, which defines all the types and functions, just tell your c++ compiler glsl-files are to treat as cpp headers and all the sweet benefits of autocompletion and stuff are ready for your glsl code.

Check it out: https://github.com/Wh0p/Wh0psGarbageDump/blob/master/syntax

http://www.gamedev.net/topic/657788-glsl-syntax-highlight-and-auto-completion/


In Topic: [GLSL] Prevent lights from casting onto shadows

01 January 2015 - 02:19 PM

The "min" approach seems legit to me. Multiplying the lambert lighting term with the shadow scale will just dim the shadowed areas. I think of shadowed areas as areas, where only the ambient term effects the shading of the lightsource and diffuse and speculare are zero.

Having not solved your problem with this I only may recommend you this article from nvidia for edgeblurred soft shadows:

http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter17.html

 

Theres a neat explanation with code and pretty decent results.


PARTNERS