Bit by Bit

Very good tutorial and example of shadow mapping on the ios or android really any device.
A good guide to keep your head on straight when constructing it. And I agree with him. I have no idea why people go to all the effort of transforming out of camera spaces inverse and the like when you can map directly to the rendered frame buffer object through the light projection and view matrices… anyway this method is much faster.

Getting much better =)

With Spinning light…

Now to get it in the game and test out the edges I expect I will blend the edges by clearing the viewport in full rez then render to a subset….back to work!

Is how you program systems.. and the bit I am on right now is getting the shadows into the correct space… I am transforming the vertex position back into the light cameras view space to get the sample points for the depth map render. Somewhere in that mess I have a mistake and it could be in my scene graph. I am close however and when I am done with this I really do not see anymore difficult code chunks left. This required some additional functionality added across the scene graph but overall again I am very pleased with the robust nature of this scene graph =)..Hopefully I will be back into eye candy and game talk soon this stuff can wear on you.

Here is where I left it last night. As you can see the map is not mapping properly to the eye space and the camera eye space. Something that should be simple is turning out to be elusive =)

And there is the error… those values there should map into the light and the colors should be at the edges or close really.. hmm very strange…

WOW found it…. sheesh stupid.. the magical W component of the bias matrix I had set to 0.5 not 1.0… NICE!

So for a quick explanation of how Shadow mapping works. It is actually much easier then Shadow Volumes. First you create a render texture and use a camera to render from the light to the target into that render buffer only drawing to the Depth map (front face culling helps in artifacts!). Then take the Frame Buffer Object and use it when you render the object and for the “shadow” part of the shader simply transform the untransformed point BACK into the light cameras space EXACTLY as you did when you rendered it into the FBO. This will place the puppy back into the map you rendered and a reference point for how far away it was from the light. With some Magic W action check the difference of the two and see what is in front. I need to optimize this shader someday as it is the work horse in the game but that is for later for now I need to finish up this shadow mapping fun =). A BIG tip when working on this is to line up the camera and the light cam and then attempt everything that way you can narrow down the variables. =)


Mondays Goals

Bed time =).. I got all the way to the Light Matrix I need to figure out. It should not be hard but something has me stuck for now…most probably the need for sleep =).. Good stuff, Good day, I hope everyone’s was the same! =)

Mission Europa is still waiting for review and no word from anyone of anything major! =)..

So now the system completely works inside of my scene graph. Take a transform hang a shader if you want to see the light. Then hang a camera with references to places in the graph you want to render and whammmmmmoo!…Depth buffer (or color depth and stencil whatever…) Next step is to get this integrated into the lighting equation with the bias matrix an light matrix weeeee matrix math…

Here is the first step =)

I scaled up the z buffers close area so it is more visible otherwise it would be very hard to see..
Next step Shadow Matrix! =)

1. Shadow mapping!

It should be a walk in the park to get shadow mapping into my engine. I plan on using the old shadow volume code for light rays cast off objects later. To place shadow mapping into my engine I plan on using a shader override. When the renderer runs down my scene graph the models store the level of detail of the last camera they were rendered with. Thus on an override the shader is forced into a depth only render and the lod is not altered by the shader at render time for the models. This means a model will still be at what level of detail the last render was at. So if the camera is far from the light you will not have artifacts with higher LOD models next to the light. The shadow map shader will take into account the 1st testure registers alpha with an alpha test of 0.5.
The process will be
Render from the lights point of view only rendering to the depth map. (hopefully the camera is not moving to fast that the last LOD holds for the most part…in cursed realms it will not if so a pre lod run will be required.) Then render the scene normally using the shadow map generated and transformed using the light to camera matrix and a bias to move the -1 – 1 space into a 0 to 1 space. Good stuff and the results should be spectacular.

Really good progress

I cannot wait for the Mission Europa Patch to get released!

Today I got most of the goals complete and I am actually close to level creation. I plan on getting shadow maps implemented soon. The shadow volume code can still be used for light rays, however the fill rate impact is just far to high. I will probably start that tomorrow it hopefully will not be to difficult. It will limit my lights to directional only. I might go for teh omidirectional shadow maps. The problem there is even more of a hit per light. I would rather have 6 directional lights then 1 light with 6 shadow maps. Any-who that should be exciting. For now back to work!

Btw here is a great refresher or tutorial on simple shadow mapping using render to textures and a light to view transform matrix. Pretty fun to see a 2.0 * x – 1 for the -1 to 1 transform and scale to 0 – 1 with a matrix using 0.5 down the identity chain of ones and then the transform of 0.5. Great quick and concise article without what sometimes I think is purposefully difficult to follow jargon and terminology.

Saturdays goals

1. Finish the command printer.
2. Check the level uploaded to the server against what I get back and be sure they are exactly alike minus comments that are in the starting databas and are lost when an object is serialized.
3. build a level and save it
4. Get the ipad out and start constructing and saving a level to the web.
5. Make more awesome every step. Improve tools every step.

Happy Saturday all and do not forget UFC free tonight on FOX 8pm et.

Creating an in game editor…

In all my experience the more in game editing and testing that can occur the better. It is like creating a sculpture. Would you rather due so by verbally telling a person what to do or would you like to get what you want by directly carving it. That is where I will be this weekend. Adding better tools to get level one DONE finally.. 😉

I updated the wiki to include the design for the final editor.–EditingLevel

P.S. No word back yet on any major issues in Mission Europa… good stuff =)

Today a break from Mission Europa

Back To Cursed Realms… aaaahhhh That Mission Europa Jaunt made me really appreciate the new design and engine =)

Back to cursed realms for fun! So far thanks to Doom and MrSpud all I have reported so far with mission Europa is a bug standing over a legendary relic that loops an effect and energy weapons sound effect bugs.. Both can wait for the next patch as stability is my number one huge concern ;). So that is actually pretty good news being the huge amount of surgery I did on mission Europa’s innards.
The problem with how I built Mission Europa’s engine is it started evolving on me. I stopped “designing code to solve issues and started brute forcing things. The next thing you know I have ballooned the code base and I would say more then half of the compiled code should be data driven design. In cursed realms I am 100 percent the opposite. I also wrote it to where everything has a sting based name and the entire running engi e can be logged in real time. I can inspect just certain items. The largest change is the serialization from a data tree I designed. Where all objects start from a database and then are serialized with their current state to a file or across the web. Bog differences also in the graphics as cursed realms is 100% next gen and OpenGL es 2.0. Cursed realms is all shader driven with no fixed function pipeline. That is what took the longest time. I had to write everything down to the trustful for the camera for it’s projection, view, and the model matrix. Any who things are looking good now and I will get a break from mind numbing debugging to work in that stage that is the most fun. The experimental stage! 😉

Happy Thursday all!

In jumping back into Cursed and upgrading to 5.0..OpenglEs 2.0 has had some changes aqlong the way in one of the million releases it seems I have not read…So now my light vectors and what not transforming into my shader are borken.. weird.. fun stuff.. But hopefully this will be the last time I have this big an update until launch 5.0 was a big change….

Ahh I had an error that ios 4.x let by… I had glUniform4fv with a 4 for count when it should have been 1..

Note for other devs if your shaders work in 4.x but just show black in 5.0. Then look at your glUniformXfv calls. I had a few where I called glUniform4fv(program,4,pointerToFloatArraySize4);where the number 4 of course should have been 1… whoops… that got by in version 4.x. Anywho that took a long time to figure out being that I had to look at the color responses in shader results to figure it out!..

Mission Europa Patch Complete….

Update: Made it to Quest 8 on level 2 the last one.. One crash in all 1.5 hours playing. Do I want 0 crashes yes… BUT does 0-4 sales a day warrant the level of attention it would require for the out dated and thrown away Mission Europa Engine when I have Cursed Realms to create with a totally awesome completely debug-able and totally new engine that is 100x easier to debug?… I do not think so… So I am happy for now there. If you testers find something crazy let me know it is time to eat some dinner for me it has been a LONG 4 days… My Cursed Realms Memory debugger detected a memory stomping but I could not track it down without much more time involved and the crashes I DID fix make me want to get this out now it was damn near un-playable due to the updates…If I get more complaints post patch or Mr-Spud or Doom or any other tester say they want more I will =). However, I feel pleased now with the crap ass audio engine replaced and 149 errors corrected among other fixes. Time to upload the standard build for its update….LET ME KNOW IF YALL FEEL DIFFERENTLY TESTERS PLS =)

P.S. The crash was in level transition SO the saves were fin I just had to relaunch and load… no time lost.

P.P.S. If Skyrim can crash on my PS3 as much as it does maybe people can cut a team 1/100 the size some slack on the shifty and sometimes unpredictable IOS and ObjC ;P
Update: lol spoke to soon quest 7 crashed on skipping intro to level. Cryptic modified freed object arg…one is not bad it was constant before… and it ran for an hour while I changed both cars oil 😉
Update: Quest 6 no crash…. crossed fingers… still 30+ min of gameplay is a good amount compared to before
Update: They may not have been crashes as my son was the one testing and I think he hit the square button.. but we shall see still playing…so far Quest 8 no crash…(besides a possible one after the tutorial)

Ok going to play Mission Europa a little tonight…but then FINALLY back to cursed realms and creating cool not fixing cool =P…

Update: Downloaded and played the first 3 quest on iPad for the first time in a game non debuge format… very nice =).. rather enjoyed it =)

Update Upload complete…I am downloading it now and will let y’all know if it all went well =).. this is my SECOND time using test flight so please let me know if there is an error I can fix it pretty quick =)…

Update: Uploading to test flight. =)

Finally 4 hard long nights and some days and here she is!… I will be making the build and uploading to test flight as soon as I can get back through to apple with my mac mini =)…..

Largest Fixes in patch:
Ripped out old sound system
Placed in Cursed Realms Sound System
Ripped out Music System
Placed in Cursed Realms Sound System
Fixed numerous memory issues
Added in back stops to prevent to many sounds from playing and overloading memory.
Stopped multiples of the same sound from playing.
Placed in new memory tester.
Ran hours of tests looking for mem-overruns
Removed over 149 warnings from the new 5.0 compiler
Many Many smaller fixes..

My new memory debugger I wrote for Cursed Realms is doing a number on Mission Europa =)… It has found several issues I need to resolve. I do not think it will take to long tonight as I made a huge amount of headway last night. I will post as I garner more data but for now I still think I MIGHT be able to get a build done tonight…

Funny thing I ran into during debugging… I SEE A LIGHT!
(I turned of skeletal updates in a test I ran) =)

another side effect… kinda funny =)