Wednesday, August 21, 2013

Hey guys. It's been a long time since I posted anything about my engine kagura. I've started working on Physically-Based Lighting, and Clustered Deferred Shading with Forward+ will be the next big renderer change. Yes, I do enjoy rewriting my renderer fairly often it may seem. That's why I architected a plugable renderer! ;) First a screenshot of the latest alpha build with some horrible debug spew all over the place:

Currently I have Lambert with a Normalized Blinn-Phong enabled as I have stopped toying with the Oren-Nayar to get to some real business -- Removing the MDR system to replace with a standard HDR system with filmic tone mapping. 
Still using random assets from the web and what I can do with blender.  Really need to contract a professional artist do do a rigged character model with a walk cycle soon.

Also the editor has fully generic property mappings now.  This means you can bind script from native code or script to procedurally generate the UI on the target device such as a desktop webbrowser, nexus 7, or galaxy note in my case(s).  It's not pretty, but it gets the job done.  From native code this is how a bind looks:

KAEDITOR_PROPERTY_RANGE( "Exposure", 0.1, 4.0, mCamera->Exposure(), 0.01, Exposure ); This generates the JSON subpacket to be issued to the HTML5 editor when requested. This would look something like this for a full fresh:
"KaCameraComponent" : { "Properties" : [ { "name" : "Debug", "type" : "bool", "value" : 0, "script" : "$type.SetDebug( $instance, $value )" },{ "name" : "Culling", "type" : "bool", "value" : 1, "script" : "$type.SetVisbility( $instance, $value )" },{ "name" : "Field of View", "type" : "float", "value" : 60.000000, "script" : "$type.SetFieldOfView( $instance, $value )" },{ "name" : "Exposure", "type" : "range", "value" : { "min" : 0.100000, "max" : 4.000000, "value" : 2.000000, "step" : 0.010000 }, "script" : "$type.Exposure( $instance, $value )" },{ "name" : "Near", "type" : "float", "value" : 0.100000, "script" : "$type.SetClipNear( $instance, $value )" },{ "name" : "Far", "type" : "float", "value" : 12000.000000, "script" : "$type.SetClipFar( $instance, $value )" },{ "name" : "Clear Color", "type" : "color", "value" : [0.219000,0.219000,0.219000,1.000000], "script" : "$type.ClearColor( $instance, $value )" },... ] } }

This is then processed in javascript into HTML widgets with signals, updated values, and handlers. A preprocessor in javascript allows for Lua script expansion to save time yeilding something like this for the KaTelemetry callback ( html->js->lua on the remote host/game ) :
KaTelemetry( "KaCameraComponent.Exposure( KaGameObject.GetComponent( KaGameObject.FindByGuid( 0 ), "KaCameraComponent" ), 1.97 )" )

All this happens while you drag your exposure slider around. Yeah I decided to put in on the camera instead of in the Image Filter material while I was testing the tone mapping and linear color changes. This also allows for very complex scripting across the HTML editor and game host / remote server, but this is a simple example. I need to clean it up and optimize it, so I can do a full study and write-up at some point. :D