Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Jun 2011
Offline Last Active Mar 28 2016 05:41 AM

Topics I've Started

GLSL halfvector?

07 May 2015 - 09:07 AM

In the GLSL docs, it says halfVector is derived for gl_LightSource, however it doesn't really say how it's derived. Question is, does it take into account whether the light source is directional or not, or must I calculate the halfVector myself in this case? I'm somewhat hesistant to use gl_LightSource[0].halfVector.xyz without knowing how it's derived.

GLSL Directional Light

14 April 2015 - 08:07 PM

I'm trying to setup a basic directional light that matches the fixed pipeline.

However, my GLSL version looks like a point light, with very dark edges.
Ambient is zero, specular is zero, and attenuation is off, so it doesn't interfere.

How can I match the same shading as seen in the fixed version?




varying vec3 N;
varying vec3 L;

void main()
    N = normalize(gl_NormalMatrix * gl_Normal);
    L = normalize(gl_LightSource[0].position.xyz);	// directional light

    gl_Position = ftransform();



varying vec3 N;
varying vec3 L;

void main()
    N = normalize(N);
    L = normalize(L);

    float lamb = max( dot(N,L), 0.0 );
    vec4 diffuseColor = vec4(1,1,1,1);
    gl_FragColor = lamb * diffuseColor;

Unroll rotations?

24 June 2013 - 01:22 PM

Can someone explain in pseudo code or the math how this might work.  It's called Unroll Rotations:




"Compensates for gimbal locking effects by unrolling rotations. Unroll Rotations is designed to clean motion capture data that contains
large rotations which cause flipping or shaking in animations."


Basically, what's given, is 3 rotation curves (x,y,z) expressed in Euler angles.  These curves are initially locked to -180 to 180 degrees.  After unrolling, this limitation is removed.


What I don't understand about this is, why do they focus on the Y curve?  Aren't these curves unrolled independently of each other?   If not, then how does unrolling one curve affect the other? I just don't understand the "unrolling" algorithm used here.


Computer vs Physical Games?

07 November 2011 - 06:31 AM

Let's say someone created and commerically sold a game (board game, puzzle game, etc..) before computers were popular.
This is a physical game. In other words, you can play it using your hands.

Now, let's say, today, someone else created a computer game (iPhone, Windows, etc...) based on the same game concept.
But, of course, the names and graphics are all different.

Question is, is the game logic, game rules, or game play (the way a game is played) copyrighted?
Would it matter (in terms of not getting sued) if the game was first created as a physical game?


Sort and remap?

20 June 2011 - 12:27 PM

Is there a general C/C++ template or class I can use that can sort an array, but also return a remapping array?
(from old to new indices)