Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 19-09-2005, 08:56 AM   #1
Nick
Переводчик помаленьку
 
Nick's Avatar

 
Join Date: Dec 2004
Location: Protvino, Russian Federation
Posts: 340
Send a message via ICQ to Nick Send a message via Skype™ to Nick
Default

I wonder, how people achieve such great effect of lighting, for example, in Max Payne. I heard about Phong method of lighting (by default we use Gouraud), but just don't know how to do it in OpenGL. Does anybody know some sources?
Red Book advises to divide large polygons into small ones, but then, when you try to create spotlight, you'll see not round spot, but jagged.
__________________
"Paladin work is never done..."


Nick is offline                         Send a private message to Nick
Reply With Quote
Old 19-09-2005, 10:06 PM   #2
Blood-Pigggy
10 GOSUB Abandonia
20 GOTO 10
 
Blood-Pigggy's Avatar

 
Join Date: Jan 2005
Location: Wilmington, United States
Posts: 2,660
Default

Max Payne largely was it's own engine, and using that they can incorporate their own lighting and graphics system into it, then allow a 3D card or 3D service to read the data then execute it using all parts such as the 3D renderer and etc.
Otherwise I have no idea how you can actually do it in OpenGL
__________________
Youtube Channel -
http://youtube.com/user/BloodPigggy

My Site -
http://sites.google.com/site/eyenixon
Blood-Pigggy is offline                         Send a private message to Blood-Pigggy
Reply With Quote
Old 04-10-2005, 07:36 PM   #3
Nick
Переводчик помаленьку
 
Nick's Avatar

 
Join Date: Dec 2004
Location: Protvino, Russian Federation
Posts: 340
Send a message via ICQ to Nick Send a message via Skype™ to Nick
Default

Here's what I achieved after reading some literature (actually it was presentation).
Pretty far from life, but it's only beginning... Please, if you have any advises, it would be very good.
__________________
"Paladin work is never done..."


Nick is offline                         Send a private message to Nick
Reply With Quote
Old 16-10-2005, 01:46 PM   #4
Nikson
Game Wizzard

 
Join Date: Oct 2005
Location: Cairns, Australia
Posts: 260
Default

The Phong model is much more computationally intensive, so it's not used for real-time 3d rendering (like games). OpenGL uses only Gouraud for this reason.
Dividing large polygons into smaller ones will provide a much more accurate lighting effect, since the same surface as before has more detail - specifically, each of the new polygons has its own normal vector that is used to better approximate light reflections and the shading model.


As for your lightmap test -

Notice how when the ball gets close to any wall, the parts of the surface outside the spotlight falloff area become very dark? The simplest way to fix that is to have a small amount of white ambient light in the room.
Nikson is offline                         Send a private message to Nikson
Reply With Quote
Old 16-10-2005, 06:10 PM   #5
Nick
Переводчик помаленьку
 
Nick's Avatar

 
Join Date: Dec 2004
Location: Protvino, Russian Federation
Posts: 340
Send a message via ICQ to Nick Send a message via Skype™ to Nick
Default

Quote:
Originally posted by Nikson@Oct 16 2005, 01:46 PM
The Phong model is much more computationally intensive, so it's not used for real-time 3d rendering (like games). OpenGL uses only Gouraud for this reason.
Dividing large polygons into smaller ones will provide a much more accurate lighting effect, since the same surface as before has more detail - specifically, each of the new polygons has its own normal vector that is used to better approximate light reflections and the shading model.


As for your lightmap test -

Notice how when the ball gets close to any wall, the parts of the surface outside the spotlight falloff area become very dark? The simplest way to fix that is to have a small amount of white ambient light in the room.
I said before, that dividing polygon into smaller ones results in "jaggs" and we loose in performance. More than that, many modern games use lightmaps (Quake III for example), because we can win in speed - first, because we use lightmaps, thus giving all job to video card instead of processor, and second, we can use multitexturing from video card extension, thus winning in speed more.
You're right, for example, when you create a surface with evaluators or when you rendering a model, loaded from some editor, of course, there's no reason in using lightmaps. But when I tried to divide polygons in one of my program, I got only 24 - 25 FPS plus those jaggs, when I created spotlight, whch light fell on the floor consisted of small polygons.

EDIT: It's better to change texture coordinates instead of polygon's with lightmap. We can keep depth test on in this case. If you use two pass multitexturing, of course.

EDIT EDIT: By the way. Maybe I wrong, but today, when I wrote another prog with lightmaps, I discovered, that lightmap coordinates forestall bubble coordinates in 12.5 times! In that program you can move round bubble with keys, so together with bubble, alter lightmap texture coordinates.
__________________
"Paladin work is never done..."


Nick is offline                         Send a private message to Nick
Reply With Quote
Old 16-10-2005, 10:33 PM   #6
Nikson
Game Wizzard

 
Join Date: Oct 2005
Location: Cairns, Australia
Posts: 260
Default

I didn't argue about dividing into smaller polygons affecting performance. Obviously, the more objects there are in the scene, the more calculations it takes to render. However, I've never heard of anyone getting a worse image from using more detailed objects, with lightmaps or anything else. Strange.
Nikson is offline                         Send a private message to Nikson
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kens Labyrinth Sebatianos Games Discussion 21 08-01-2015 06:41 PM
Opengl nace Tech Corner 10 28-10-2006 08:25 PM
My Opengl Program Nick Programming 2 16-06-2005 06:26 PM
Opengl Environment Mapping Nick Programming 1 15-04-2005 12:52 PM
Opengl NrmMyth Programming 9 29-03-2005 09:51 AM


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 10:13 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.