Jump to content

  • Log In with Google      Sign In   
  • Create Account

2 Questions about Lighting


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Captacha   Members   -  Reputation: 141

Like
0Likes
Like

Posted 12 August 2012 - 08:24 AM

1. If I plan on using .OBJ files for my models, do I have to learn how to calculate normals?
2. It seems OpenGL only has support for 8 unique lights, is there any way to add more? For instance, If I wanted a bunch of streetlights, I would run out pretty quickly.

Sponsor:

#2 Waterlimon   Crossbones+   -  Reputation: 2637

Like
0Likes
Like

Posted 12 August 2012 - 08:32 AM

2.I dont know, you could:
-only use those 8 lights at a time but pick the ones that affect the scene/polygon/whatever the most at the time.
-write your own shaders. If you want to do something the fixed pipeline cant or is too slow for, you need to write your own pipeline. It requires you to do all the matrix stuff and every single feature yourself though.

If you want better graphics and dont want to write your own shaders, use some existing graphics library/engine

o3o


#3 slicer4ever   Crossbones+   -  Reputation: 3981

Like
0Likes
Like

Posted 12 August 2012 - 08:32 AM

1. If I plan on using .OBJ files for my models, do I have to learn how to calculate normals?
2. It seems OpenGL only has support for 8 unique lights, is there any way to add more? For instance, If I wanted a bunch of streetlights, I would run out pretty quickly.


1. .OBJ files support vertex normals. rather a particular file has them or not, is up to the exporter.
2. OpenGL's fixed pipeline supports n number of lights, n can be queried with glGet and GL_MAX_LIGHTS as a parameter. 8 is the minimum number of lights every implementation must support to be openGL compliant.

A common trick is to only set lights nearest to the camera as to on/off. secondly, baking lights into static models might be another avenue to take.

Edited by slicer4ever, 12 August 2012 - 08:33 AM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#4 SimonForsman   Crossbones+   -  Reputation: 6304

Like
0Likes
Like

Posted 12 August 2012 - 09:41 AM

2. It seems OpenGL only has support for 8 unique lights, is there any way to add more? For instance, If I wanted a bunch of streetlights, I would run out pretty quickly.


The max number of lights is per vertex and pass, you can move/modify the lights whenever you want, including in the middle of rendering so you can change which X lights you want active on a per model or even per triangle basis, if your lights are static or animated you can also create static/animated lightmaps and use those for any static geometry(animated lightmaps eat up quite a bit of memory though but for things like flickering lights it might be worth it).

You can use multipass rendering and additivly blend the results together (This lets you use an unlimited number of lights even with the fixed function pipeline (just don't go too wild as each pass takes time).
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS