• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MARS_999

Sun light in space

6 posts in this topic

I am not sure what I should be using to do this, but I have a star in space, and want it to be the source of light for all the planets and such. Do I want to use a point light for this? Or is there some better way? I am guessing directional isn't what I want due to the star should emit in all directions...

Problem is I would also like the sides of the planets that aren't facing the sun to be somewhat light so the player can see them easier....

Any ideas on this?

Thanks!
0

Share this post


Link to post
Share on other sites
It kind of depends on how you are representing your solar system.

If you are going for some kind of realistic sim approach, then due to the distances involved you're probably not going to want to draw all your planets in one 3d space anyway. You'd probably be better off rendering all but the very nearby objects to billboards with directional lighting and only updating them when the player/planet/sun angle changes by some amount (which will be fairly infrequent).

If your solar system is a bit more abstract, with shorter distances and larger planets so you can see more detail on screen at once, you would possibly be better off using the directional light.

For lighting the dark sides, tweak the ambient light values. Alternatively, look into some kind of rim lighting or atmosphere effect to give you a really dark 'dark side' but still making the outline visible.
0

Share this post


Link to post
Share on other sites
[quote name='MARS_999' timestamp='1336194921' post='4937554']
I am not sure what I should be using to do this, but I have a star in space, and want it to be the source of light for all the planets and such. Do I want to use a point light for this? Or is there some better way? I am guessing directional isn't what I want due to the star should emit in all directions...
[/quote]

The distance between star and planets makes directional lighting realistic. A player would not, generally, travel enough distance to change the vector of light, unless they were traveling FTL.


[quote]
Problem is I would also like the sides of the planets that aren't facing the sun to be somewhat light so the player can see them easier....
[/quote]

Ambient lighting.
0

Share this post


Link to post
Share on other sites
ok, but what I am failing to understand is, with the sun at position(0,0,0) and say earth at 15,0,0 and it rotates around the sun the earth should be lit always when facing the sun, but with a directional light I don't see how this can be when I state a directional light of say 1,1,1 wouldn't I need a directional light of -1,-1,-1 also?
0

Share this post


Link to post
Share on other sites
It should probably be modelled as a point light, emitting in all directions, you obtain the light direction by subtracting the world position of the pixel to light with the point light's position. Basically the light direction to a point P will be the vector going from the point light to P (normalized, if needed).

Directional light only makes sense if the light source is very, very far away and you cannot see any point with a significantly different directional vector to the light source. This works if you are an observer on the Earth, looking at the sun, as there is nothing to see "behind the sun", but it doesn't work if you are in space, as you will be able to see planets rotating around the Sun, which will break down the illusion.

But this is for a realistic simulation, you may be able to get away with directional lighting, it depends. But why would you want to? It's not like directional lighting is infinitely cheaper than other alternatives.Directional lighting is just an extreme case of a point light, in which the latter is located infinitely far away from the observer in the appropriate direction, which allows some simplifications.
0

Share this post


Link to post
Share on other sites
Calculate light direction per object basis and then use that as directional light.
1

Share this post


Link to post
Share on other sites
I would say it depends on the number of other light sources in the scene. If your sun is the only light source (or one of very few sources), then it's probably fine to use a point light, as it would be closest to simulating what you want. This way you can give more time to rendering a higher-resolution light map from that one point light, to compensate for the large distances / comparatively small items involved. If there are a lot of lights then a directional system is probably best, and simply update the light direction when your position moves sufficiently.

If you're also dealing with a lot of objects all around the star you could use the following in the vertex shader before your lighting stage:

[CODE]const float3 sunPosition //sun position, I've used a constant here because I assume it doesn't move.
float3 position //untransformed position at that point

float3 lightDirection = normalize(position - sunPosition); //gets the direction the light will be travelling towards your object from the sun - push this to the pixel shader to get per-pixel light directions for each rendered pixel, then simply run the standard direction light code.[/CODE]

Even better: put the sun at the origin (0,0,0) and you don't have to do that initial calculation. simply normalize the position of the vertex in the world. Edited by NickUdell
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0