0 Favourites

heightmap mask and multiple lights

This forum is currently in read-only mode.
  • Hey,

    there`s another one coming:

    Problem:

    You want to render a scene containing multiple radial lights including heightmaps. When you apply a heightmap effect to the texture, there`s only one light, so multiple superposed lights will fail to render correctly.

    Solution:

    Create a layer with the diffuse/ compiled texture, then below a layer with the heightmap. The light sprite incorperates the following shaders:

    1.

    A shader that grabs the pixels two layers below the current sprite

    (e.g. the global variable texture viewer in fisholith`s shader pack: scirra.com/forum/topic46099_post288721.html

    2.

    A shader that shapes the sprites to an ellipse with smooth transition.

    (e.g. the one made by Tulamide scirra.com/forum/effect-ellipse_topic51611.html)

    3.

    the heightmap shader with light position information.

    Applying the shaders in this order the sprite will use the heightmap below the diffuse texture, blend it over in ellipse shape and renders the lighting on the heightmap information.

    Additionally, for every light in the scene/ on the level or map, you can center the light x/y. to have the light rays radiating from the center of the source.

    Heightmap blend:

    <img src="http://www.schade-blog.de/schade-studios/bumpmask.png" border="0">

    Final composition:

    <img src="http://www.schade-blog.de/schade-studios/fullscene.png" border="0">

    The render techniques are quite expensive, but this is probably the closest thing you`ll get to a realistic lighting engine in Construct with a somewhat marginal effort.

    Grab the example cap here: http://www.schade-blog.de/schade-studios/bumplights.zip

    I included the effects that accomplish this in the zip, hopefully by their creator`s leave.

    Credits go out to fisholith, Tulamide and Jorge Fuente-Alba.

    Cheers,

    the Colonel

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Hey Colonel,

    pretty smart approach you got there, congrats!

    I'd like to understand your concept, because i thought about pretty much the same idea the last days... so a few questions arise:

    • How do you handle pixel perfect light postions on a layout bigger than DisplayWidth? I think in the current cap the lights are tied to the viewport.
    • Do you see any chance colorizing the lightsources?

    thanks!

  • Hey,

    it`s true, I have to tinker a formula for the lights position relative to viewport and layout size. Best way would be probably to do it through a shader variable.

    The light sources can be colored easily, just append a coloring shader to the pipeline, like NouvoFill or something else.

    Cheers!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
308 38,076
damainman's avatar
damainman
Unread hot topic
107 13,191
LeuNoeleeste's avatar
LeuNoeleeste
Unread hot topic
74 8,087
eli0s's avatar
eli0s