Note: Graphics 2.0 is now in public beta for all Corona SDK Pro and Enterprise subscribers. Please see Walter’s recent blog piece on the news.


Just a quick preview of what’s coming in the next update of graphics 2.0 that we’ll be seeding out soon to alpha testers.

It’s a feature known as normal mapping and it’s a workhorse technique for simulating lighting effects in traditional 3-D graphics. We’re repurposing it so this is trivial to do in Corona.

For example, here’s how how you can achieve a point light effect:

local multitexture =
{
	type="composite",
	paint1={ type="image", filename="image.png" },
	paint2={ type="image", filename="normals.png" }
}

local object = display.newRect( 0, 0, 200, 200 )
object.fill = multitexture
object.fill.effect = "filter.normalMapWith1PointLight"

 

All effects have property knobs that you’ll be able to play with. In the point light, one of those knobs is the position of the point light. In the video below, we’re just moving the position in a circle:

  1. This is what I’m talking about!,,, will we be able to have multiple point lights!? Just checking in case of multiple magic missiles being fired. I might have to attack the darkness!

    :)
    -Mario

  2. I don’t want to sound like some sour grape but back in May you said about Graphics 2.0::

    “BTW, if you are hankering to get your hands on the new graphics engine, we will be seeding this out to beta testers very soon — possibly as soon as next month!”

    Where “next month” would have been June and the “new graphics engine” is denoted as Graphics 2.0.

    In this post you say “Just a quick preview of what’s coming in the next update of graphics 2.0 that we’ll be seeding out soon to alpha testers.”

    So where does Graphics 2.0 really stand? Is it already being tested with beta testers or not?

    • Chase – some of the features will be available to Starters, but many only to Pros. The final list is still being figured out.

  3. While I appreciate the effort to keep things simple, at some point I feel like I should just have direct control, a bit like this:

    local lux = display.newPointLight(color, intensity, x-position, y-position, z-position)

    And then have a z-position property for image. I know I’m oversimplifying here, but there comes a point where you start to stifle too much power under the hood for me. Of course I’m the type of guy that uses the openAL hooks instead of the Corona sound engine…

    • Actually, you will get a lot more than I showed, but since you asked.

      The first thing you get is sensible defaults chosen for you.

      On top of that, you’ll be able to control the the effect properties. For the point light, it would look something like:

      local effect = object.fill.effect
      effect.pointLightColor = { r, g, b, a }
      effect.pointLightPos = { x, y, z }
      effect.ambientLightIntensity = 0.3 — value from 0 to 1
      effect.attenuationFactors = { a, b, c }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>