lighting

How do I make the lights stay fixed in the world with Direct3D

I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects. In OpenGL light positions get transformed just like everything else with the MODELVIEW matrix, so to get lights fix...

What kind of light environment do you prefer to work in?

What type of light do you prefer to be working in? How do you have your light source(s) situated? Wattage? Any particular lamp recommendations? Is there any sort of lighting environment that you hate? ...

Calculating which tiles are lit in a tile-based game ("raytracing")

I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help. The situation is like this: There is a tile-based map (held as a 2D array), containing a single light source and several items standing around. I want to calculate which tiles are lit up by th...

Techniques to smooth face edges in OpenGL

When I light my human model in OpenGL using face normals it is very apparent where each face is on the model. The lighting becomes considerably smoother using vertex normals but still noticeable. Is there any technique available to smooth organic models without adding additional vertices (ex. subdivisions)? ...

Lighting issue in OpenGL

Hello, I have trouble developing an OpenGL application. The weird thing is that me and a friend of mine are developing a 3d scene with OpenGL under Linux, and there is some code on the repository, but if we both checkout the same latest version, that means, the SAME code this happens: On his computer after he compiles he can see the ful...

OpenGL GLSL interpolation

Hi I try to implement point lights in OpenGL with GLSL. I send all the required data to the shaders. For simplicity I only use the diffuse light here. My example shows a huge triangle which I want to illuminate with a single light source. The light source is shown as a small blue triangle. For diffuse light I need to know the angle be...

Recommended 3D Programming Aspects for Light/Laser Show Simulator?

Hey guys, I would like to develop a light/laser show editor and simulator, and for this of course I am going to learn some graphics programming. I am thinking about using C# and XNA. I was just wondering what aspects of graphics programming I should research or focus on given the project I am working on. I am new to graphics programming...

How do I fixate a light source in OpenGL while rotating an object?

I have a glutSolidTeapot (which has its surface normals generated automatically according to opengl.org) and a light source which is emitting diffuse light. The problem comes when I try to rotate the teapot: it seems like the light source is doing the rotation as well, not remaining in the same position I defined it (it essentially follo...

How to transform directional light to camera space in GLSL

I have the following GLSL code for lighting: uniform vec3 lightDir; // Parallel light uniform float ambient; uniform vec3 lightColour; void main() { gl_Position = ftransform(); vec3 eyeNormal = normalize(gl_NormalMatrix * gl_Normal); float intensity = max(ambient, dot(eyeNormal, normalize(-lightDir)); gl_FrontColo...

opengl light problem..

I have loaded an object, and when I draw the object, I set the color to green.. After drawing the object, I draw lines in red. It all worked out fine. The problem arise when I input lighting properties. When I create a light source, everything where the light projects becomes white. Why does the lighting over writes my color? And how d...

OpenGL lighting problem when rotating the camera

I draw buildings in my game world, i shade them with the following code: GLfloat light_ambient[] = {0.0f, 0.0f, 0.0f, 1.0f}; GLfloat light_position[] = {135.66f, 129.83f, 4.7f, 1.0f}; glShadeModel(GL_SMOOTH); glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); glLightfv(GL_LIGHT0, GL_POS...

How can I make a ball of light in openGL?

I'm trying to make a orb of light (Like a sun) but I can't seem to make it visible at all. I'll give you some snipets of code I have. It's in Java LWJGL, so it might look a little different. private float lightAmbient[] = { 0.0f, 1.0f, 1.0f, 1.0f }; // Ambient Light Values ( NEW ) private float lightDiffuse[] = { 1.0f, 1.0f, 1.0f, ...

[OpenGL] Working with Lights

Trying to get a grasp on lights and working through the OpenGL Superbible book. Below is what I am currently using for my lighting. It's placed in the SetupRC function. The lighting is mostly working as I expected as per position etc but I am confused on why when I turn the camera, it gets brighter on places where it was previously dark...

Are there any algorithms for removing lighting from a video?

Are there any algorithms for removing lighting from video? I have a video in which some objects are too strongly lit. How might I remove lighting from that objects without corrupting the entire video? ...

Java 3d: Unable to get Shape3D to be affected by lights

I am attempting to get a custom Shape3D to be affected by a DirectedLight in java 3D, but nothing I do seems to work. The Shape has a geometry that is an IndexedQuadArray, with the NORMAL flag set and applied, ensuring the normal vectors are applied to the correct vertices - using indexed vectors I have given the Appearance a Material ...

Adaptive threshold Binarization's bad effects

I implemented some adaptive binarization methods, they use a small window and at each pixel the threshold value is calculated. There are problems with these methods: If we select the window size too small we will get this effect (I think the reason is because of window size is small) At the left upper corner there is an original image,...

Lighting and OpenGL ES

Hi all, I'm working on getting a simple lighting right on my OpenGL ES iPhone scene. I'm displaying a simple object centered on the origin, and using an arcball to rotate it by touching the screen. All this works nicely, except I try to add one fixed light (fixed w.r.t. eye position) and it is badly screwed: the whole object (an icosahe...

How do I send information to an HLSL effect in DirectX 10?

I'd like to send my view vector to an ID3D10Effect variable in order to calculate specular lighting. How do I send a vector or even just scalar values to the HLSL from the running DirectX program? I want to do something like render() { //do transformations D3DXMatrix view = camera->getViewMatrix(); basicEffect.setVariable(viewV...

openGL rotating with Lighting problem

I want to draw car in my world. but i have problem with lighting when my car rotate ,it seems light position change when car is rotating; but when i draw simple cube with glut function it work correctly. void mydisplay(){ glLoadIdentity() glDisable(GL_LIGHT0); glColorMaterial ( GL_FRONT_AND_BACK, GL_DIFFUSE) ; glColor3f(1.0,1.0,1.0); g...

OpenGL per pixel lighting in fixed function pipeline

Is it possible to enable per-pixel lighting (so that I can have nice specular highlights on low tessellated surfaces) in the OpenGL fixed function pipeline? ...