Archive for 'papers'

Fast Mobile Shaders or, I did a talk at SIGGRAPH!

Finally after many years of dreaming I made it to SIGGRAPH! And not only that, I also did a talk/course with ReJ for 1.5 hours. This was the first time Unity had real presence at SIGGRAPH and I hope we’ll be more active & visible next time around.

Here it is, 100+ slides with notes: Fast Mobile Shaders (17MB pdf). This isn’t strictly about shaders; there’s info about mobile GPU architectures, general performance, hidden surface removal and so on. Also, graphs with logarithmic scales; can’t go wrong with that!

Strided blur and other tips for SSAO

If you’re new to SSAO, here are good overview blog posts: meshula.net and levelofdetail. Some tips and an idea on strided blur below.

(more…)

Oblique near plane with orthographic camera

Could not find any info how to do oblique near clipping plane for orthographic projections, so had to figure it out myself. It even wasn’t hard!

Here it is.

Electronic Arts STL

A paper on Electronic Arts’ implementation of Standard Template Library.

Is it insane or the only sane thing to do? It’s insane amount of work, but it looks like they know what they’re doing. STL is broken in many ways, especially on memory limited systems… Now they could release it as open source with a decent license!

Small article on matrices

I have added a small article on transformation matrices – what the values in the matrix really mean. The values are coordinate system axes of course, so if you know that already, just skip it.

An article on efficient D3DX Effects state management

I wrote an article on the subject I was talking about recently – an auto-magical system that manages device states in the effects. The article and links to implementation are on my homepage here: aras-p.info/texts/d3dx_fx_states.html

State management in D3DX Effects #2

I’ve written down the basic idea here. Done some tests and it really seems to work!

That required tiny 700 lines of hacky C++ code in the engine; but in exchange there’s no longer a need to write state restoring passes by hand. Maybe such effect usage scheme would even be useable in RealWorld!

Too bad I didn’t think it up a couple of months ago. My ShaderX4 article about this subject would have been much better…

Ok, still got to test this stuff on real world data (i.e. trying it on our demos)

State management in D3DX Effects

In my projects I’ve been using D3DX Effects with no device state saving/restoring. Instead, each effect contained a dummy “last pass” that restores “needed” state (see here; more lengthy article coming in ShaderX4).

I always wrote this “state restore” by hand. This is obviously very error-prone; it’s ok if I’m the only one writing effects but would be unusable in any real world scenario.

I think I could automatically generate the “state restore” pass. Somehow the engine knows which states need to be restored; which must be set in every effect etc. (this could be read from some file). It first loads each effect file and examines what states it touches. This can be done by supplying a custom ID3DXEffectStateManager and “executing” the effect – the state manager then would remember all states (left-hand sides of state assignments) touched by the effect.

Then the engine generates the “state restore” pass and loads the effect again. I’d image it would do it like this: each effect has to contain a macro RESTORE_PASS:

technique Foo {
 pass P1 { ... }
 pass P2 { ... }
 RESTORE_PASS
}

Which would be empty during first load and which would expand to the generated restore pass on the second load (you can supply generated macro definitions when loading the effect). The engine can check whether the generated pass exists after second load (if it doesn’t then RESTORE_PASS is missing from the effect – an error).

The downside of this scheme is that each effect file has to be loaded twice – first time for examining its state assignments and second time for actually loading it with the generated restore pass. It’s not a problem for me, I guess, because effect loading doesn’t take much time anyway… And if it would become really slow, all this stuff can be done as a preprocess (e.g. during a build).

There are many upsides of this scheme, I think: the whole system is robust and error-proof again (no longer depends on the effect writer to remember all the details about states). And as far as I can see, no performance would be lost at all (performance was the main point why I’m using this “restore pass”).

Gotta go and implement all this!

Back!

I’m back from Turkey. That’s me somewhere in the Mediterranean sea, practically showing that refraction really works – note the double hand and the mermaid-like legs :)

Right now – finishing my ShaderX4 article and preparing for Japan.

One totally insane 64 kilobyte intro: 195/95/256 by rgba. Of course, first you have to see the original 195/95 demo by Plastic. The 64k intro copies the (party version) of the demo almost perfectly, while squeezing everything in less than 64 kilobytes. Ok, the music sucks, the loading time is nearly infinite and it has lots of bugs/glitches, but I must say that rgba guys are insane anyway.

Some new books

Received GPU Gems 2 and A Theory of Fun from amazon today. The first one I bought because hey, I need it; and the second one because it’s (relatively) cheap and seemed like a good read. Indeed it is – it’s a great thing to read!