Jump to content


TheSnidr

Member Since 29 Jul 2005
Offline Last Active Yesterday, 10:36 PM

Topics I've Started

Previews Of Upcoming Games - May 2013

07 May 2013 - 10:20 AM

Sorry for being so late! We're already in May, and it's time for another showcase topic!
Here you can post pictures/videos accompanied by a short description of your game! Don't post comments on the games, this is purely to show off WIPs that don't have their own topic yet. No discussion, one post per person, and don't post projects that have their own topic.
Topic will stay open to the end of May.
A good idea is to use the reputation system to show your appreciation for the games posted!

Previous topic: http://gmc.yoyogames...opic=576409&hl=

Thesnidrs Rim Lighting Example

07 April 2013 - 05:36 PM

  • Title: TheSnidr's Rim Lighting Example
  • Description: Rim lighting is a lighting effect for 3D games. As opposed to normal lighting, which only makes unlit parts darker, rim lighting only makes lit parts lighter, and can as such make objects seem brighter and shinier. It does require rendering everything in the scene twice though, and will therefore require a lot of optimization on your part. It can be combined with normal lighting.
  • GM Version: :GMS: (can be modified to work with 8.0 and earlier, but source for those isn't provided)
  • Registered: Yes
  • File Type: .gmz
  • File Size: 3 MB
  • File Link: Host-a.net
Summary
utennavno.png
Rim lighting is normally achieved through the use of vertex shaders and calculating the angle between the camera and the normal of the vertex. Gamemaker Studio does however not support shaders at this time, but that only means we have to find other ways of doing it! This particular method makes use of the built-in lighting system. It is a surprisingly simple system - the rim lighting is basically the inverted shadow of a point light placed at the camera. This makes the parts that would normally be black white instead, and it appears the light is coming from all sides of the object. This method does however require that you to draw everything twice, even the parts that aren't lit up, which means it won't work well for scenes with lots of separate draw calls.
 
More details
The actual models and their lighting are drawn separately. First the models are drawn without lighting, then we draw the lighting on top with the help of a surface.
To make the lighting surface, we need to turn lighting on, and put a white point light on the player's position. Then we draw everything without textures, so that lit areas are white and unlit areas are black, or gray, depending on the ambient lighting. Remember that we are going to invert the lighting, so a very dark ambient lighting means we'll get very light edges.
Next, we need to invert the surface so that the white parts are black and the dark parts are light. This is done by drawing a white rectangle over the whole surface with the following blend mode:
draw_set_blend_mode_ext(bm_inv_dest_color, bm_inv_src_color);
Then drawing a black rectangle over the whole surface with the same blend mode makes it opaque (otherwise the previous rectangle we drew would make it completely transparent).
And then, for the last step, we draw the surface over the screen with an additive blend mode.
 
Some examples
Rim lighting in a project of mine:
utennavni.jpg
Rim lighting in Mario Galaxy:
supermariogalaxy2wallpa.jpg
Rim lighting in another project of mine (from 0:40)

Previews Of Upcoming Games

02 April 2013 - 09:37 AM

Here you can post pictures/videos accompanied by a short description of your game! Don't post comments on the games, this is purely to show off WIPs that don't have their own topic yet. No discussion, one post per person, and don't post projects that have their own topic.
Topic will stay open to the end of April.

A good idea is to use the reputation system to show your appreciation for the games posted!

 

Previous Topic: http://gmc.yoyogames...howtopic=573169


Previews of Upcoming Games

05 February 2013 - 03:42 PM

A little late this time! Forgive me ^^
Here you can post pictures/videos accompanied by a short description of your game! Don't post comments on the games, this is purely to show off WIPs that don't have their own topic yet. No discussion, one post per person, and don't post projects that have their own topic.
Topic will stay open to the end of February.

A good idea is to use the reputation system to show your appreciation for the games posted!

Previous Topic


Previews of upcoming games

06 January 2013 - 11:45 AM

We survived 2012! Welcome to the year of 2013's first previews topic.
Here you can post pictures/videos accompanied by a short description of your game! Don't post comments on the games, this is purely to show off WIPs that don't have their own topic yet. No discussion, one post per person, and don't post projects that have their own topic.
Topic will stay open to the end of January.

A good idea is to use the reputation system to show your appreciation for the games posted!

Previous topic