Advertisement

Problems with Spotlights in OpenGL

Started by February 03, 2001 04:25 AM
4 comments, last by THCForce 23 years, 9 months ago
Hi there! I''ve been playing around with lights, just to get the basics. So I''ve tried to use spotlights via: glLightfv(GL_LIGHT1, GL_SPOT_CUTOFF, 20.0f ); This works, but looks dirty, because the shape of the light is rather a "smooth-shaded-polygon" than a circle! Please help...............
At Night it''s colder than Outside
if the light is centered on a plane and its using flat shading, your going to get a uglly square try instead to use smooth shading
glShadeModel(GL_SMOOTH);

and try using a more curved object that is if you are if you are using a plane
Advertisement
Thanx, "anonymous poster" , for your support
but I''ve already enabled smooth-shading.

for a better understanding, I want to simulate a
torch.

Maybe someone has another idea ?

At Night it''s colder than Outside
use MUCH SMALL poligons.. it calculates the lighing just for the edges, so you need much edges to have a nice spotlight (to have a nice light at all)

when you dont want, you have to do perpixellighting.. (nvidia.com/developer)

but thats just for professional (dont know if you are..)

we wanna play, not watch the pictures

If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

yes daveperman is correct u need to use a lot more polygons in the ''lit'' object alternatively u could use a lightmap (not a darkmap ie use ADD ) and project that texture onto the object (quite difficult). if the objects static theres no need to project just draw normally with 2 single passes or 1 multitextured pass

http://members.xoom.com/myBollux
This is a commong problem for people that don't know OpenGL or 3D API.

You're using vertex lighting, so you need higly tesselated objects in order to make the light looks 'good'.

There was an article discussing Lights and how to manage them better than the API will at flipcode.
I'll also recommend you to read at least the nvidia OpenGL FAQ.

(And to learn 3d maths, 3d hardware and 3d theory, OpenGL/Direct3D books before coding, but it seems that those days everyone is thinking that this is a waste of time while this is critical.)

Anyway the texture solution could be good, if you don't alread use the secondary texture unit for something else than lighting and want to use accelerated Lighting.
(Like what I'm doing.)

-* So many things to do, so little time to spend. *-

Edited by - Ingenu on February 6, 2001 5:26:43 AM
-* So many things to do, so little time to spend. *-

This topic is closed to new replies.

Advertisement