Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Best Lighting Approach

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

#1 AppropriateUserName   Members   -  Reputation: 159

Like
0Likes
Like

Posted Yesterday, 08:13 PM

Hi,

I am developing games since a pretty long time however something I always avoided was "lighting".
Everytime I tried/try to start to dive in I just get confused really fast
but in my personal opinnion "light" is the most important ambience effect a game can offer and multiplies the graphics by a lot.

So after years of avoidance, confusing and forced ignoring I am trying to learn it by finding a start what to learn first by learning something I can use in practice(maybe it is fun then and more understandable).

It would be very nice if you could point me to the light-technique which would best suit those needs:

Needed (on run time)
1. A lot of static lights (~100)
2. Static lights can be turned on/off anytime
3. Static lights can be added/removed anytime
4. Light from one point in all directions
5. Multiple light colors

Not needed
(but would be surely a bonus point)
1. Moving light sources
2. Shadow casting
3. Light as a cone

Anything more you need to know? :)
As I said I get just confused and never got an entry point in that topic though I think it is very important.

Thank you very much
Happy holidays

Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 14411

Like
3Likes
Like

Posted Yesterday, 08:26 PM

There isn’t a single “light technique” that “suits these needs”.  You have just asked about everything from general engine architecture and lighting pipelines to advanced techniques for specific features.

Why don’t you ask one thing at a time when you actually get to that point?

 

#1: Lighting architecture.  Research deferred shading and Forward+ lighting.

#2: Engine architecture.  Nothing special here.

#3: Engine architecture.  Nothing special here.

#4: Research point lights.  You tend to get better results when searching computer-graphics terms when you add “HLSL” to the search query.

#5: Engine architecture and implicitly handled by any lighting model you use.  Nothing special here.

 

#1: Engine architecture.  Nothing special here.

#2: Research shadow maps.  Again, including “HLSL”.  There are also Direct3D samples demonstrating this and plenty of code online.

#3: Research spot lights.

 

 

For each point, ask specific questions when you get there.

 

 

L. Spiro


Edited by L. Spiro, Yesterday, 08:27 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 AppropriateUserName   Members   -  Reputation: 159

Like
0Likes
Like

Posted Today, 06:25 AM

Thank you very much.
I already feared this answer as I saw how many lightning techniques there are.

Your Google tips are worth a mint in the internet age :)
Very useful thanks, wouldn't have come up with that by myself.
Many tutorials I read about this (including stuff from Valve and way to technical stuff from NVidia) always stated that it only works by preprocessing it and not on the run.

The technique of deferred shading goes right in the direction of my own idea which is always nice to see.

Just a question according this:
A render target uses a texture as a storage. However video cards support in general a texture size of 1024×1024 with a screen resolution of 1920x1080 at the same time.
> How can I create a texture of the size of the screen for deferred shading?
- When splitting the screen size in multiple textures I would obviously need to draw the scene n-times in every buffer.
What am I missing? :-?

#4 BlueSpud   Members   -  Reputation: 449

Like
0Likes
Like

Posted Today, 01:58 PM

Thank you very much.
I already feared this answer as I saw how many lightning techniques there are.

Your Google tips are worth a mint in the internet age smile.png
Very useful thanks, wouldn't have come up with that by myself.
Many tutorials I read about this (including stuff from Valve and way to technical stuff from NVidia) always stated that it only works by preprocessing it and not on the run.

The technique of deferred shading goes right in the direction of my own idea which is always nice to see.

Just a question according this:
A render target uses a texture as a storage. However video cards support in general a texture size of 1024×1024 with a screen resolution of 1920x1080 at the same time.
> How can I create a texture of the size of the screen for deferred shading?
- When splitting the screen size in multiple textures I would obviously need to draw the scene n-times in every buffer.
What am I missing? :-?

Video cards aren't necessarily limited to the 1024 x 1024. You create multiple render targets, and then use a shader to render out to each buffer. This way you only have to take one pass rendering out the GBuffer. OpenGL and GLSL this is really easy, but I have no idea how directX works, but I'm sure its possible. Theres a lot of different kinds of deferred shading out there, and depending on how involved you want to get, tile-based deferred shading is going to be your best bet. I don't know where you read that, but its probably years old. 

 

Good luck.



#5 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted Today, 05:00 PM

You can use a "downscaled" texture for the passes/ processing.
To be honest, I'd first start with the theory of:
- a directional light (like the sun, just a direction, no position)
- a point light, with a position, a range and attenuation

When you learn this, you can start using materials,which have properties that define how the object using that material will react to/ absorb the lights.

When you get the hang of this, you can work your magic to set up a system using these lights ad materials, suiting your specific needs. Adding and removing lights can be as "easy" as:
- define a class for your lights
- create a vector to store all lights
- insert/ remove lights when you want
- send only the properties of the needed lights to your shader
(for example first check which lights affect the to be rendered object and only use those when rendering that specific object)

If you're starting I'd suggest forward lighting (in HLSL) first, and later on learn deferred if you need it. The scenario you sketched is perfectly possible without deferred rendering.

Take it step by step.

#6 TheChubu   Crossbones+   -  Reputation: 4794

Like
0Likes
Like

Posted Today, 05:24 PM


However video cards support in general a texture size of 1024×1024 with a screen resolution of 1920x1080 at the same time.
Nope. Modern (as in, anything from the last 10 years or so) cards support non-pow 2 sized textures. So you can size them whatever you want as long as its below the maximum size supported for the card (say, a pretty crappy Intel HD 2000 supports textures up to 8192 x 8192, nVidia/AMD cards go up to 16k x 16k).

 

So if you want to make a 1920x1080 texture, you can.


"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator






PARTNERS