Here’s a little story on how usability decisions need to depend on context.
In Unity editor pretty much any window can be “detached” from the main window. An obvious use case is putting it onto a separate monitor. But of course you can just end up having a ton of detached windows overlapping each other.
Here I have four windows in total on OS X: Read the rest of this entry »
Posted on 2009-09-14 15:16 in unity, work | 7 Comments »
I went to Assembly 2009 demoparty this year.
No demo submissions, but I did a seminar presentation about developing graphics technology for small games (PDF slides). Mostly on hardware statistics, GPU features, testing and stability:
Read the rest of this entry »
Posted on 2009-08-21 9:10 in conferences, demos | 6 Comments »
I’ve been experimenting with compact storage of view space normals for small g-buffers. Think about storing depth and normal in a single 8 bit/channel RGBA texture.
Here are my findings – with error visualization and shader performance numbers for some GPUs.
If you know any other method to encode/store normals in a compact way, please let me know!
Posted on 2009-08-04 11:39 in d3d, gpu, rendering, work | 24 Comments »
The saga continues! In short, I need to pack a floating point number in [0..1) range into several channels of 8 bit/channel render texture. My previous approach is not ideal.
Turns out some folks have figured out an approach that finally seems to work.
Here it is for my own reference:
So here’s the proper way:
inline float4 EncodeFloatRGBA( float v ) {
float4 enc = float4(1.0, 255.0, 65025.0, 160581375.0) * v;
enc = frac(enc);
enc -= enc.yzww * float4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);
return enc;
}
inline float DecodeFloatRGBA( float4 rgba ) {
return dot( rgba, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) );
}
That is, the difference from the previous approach is that the “magic” (read: hardware dependent) bias is replaced with subtracting next component’s encoded value from the previous component’s encoded value.
Posted on 2009-07-30 14:58 in gpu | 14 Comments »
Almost half a year ago I was wondering how to implement T&L in vertex shaders.
Well, finally I implemented it for upcoming Unity 2.6. I wrote some sort of a technical report here.
In short, I’m combining assembly fragments and doing simple temporary register allocation, which seems to work quite well. Performance is very similar to using fixed function (I know it’s implemented as vertex shaders internally by the runtime/driver) on several different cards I tried (Radeon HD 3xxx, GeForce 8xxx, Intel GMA 950).
What was unexpected: the most complex piece is not the vertex lighting! Most complexity is in how to route/generate texture coordinates and transform them. Huge combination explosion there.
Otherwise – I like! Here’s a link to the article again.
Posted on 2009-06-09 8:08 in code, d3d, gpu, rendering, unity, work | 4 Comments »
Continuing the series (see Part 1, Part 2)…
Got different lighting models (BRDFs) working. Without further ado, code snippets that produce real actual working shaders that work with lights & shadows and whatnot:
Read the rest of this entry »
Posted on 2009-05-10 17:24 in gpu, rendering, unity | 1 Comment »
I started playing around with the idea of “shaders must die“. I’m experimenting with extracting “surface shaders” for now.
Right now my experimental pipeline is:
- Write a surface shader file
- Perl script transforms it into Unity 2.x shader file
- Which in turn is compiled by Unity into all lighting/shadows permutations, for D3D9 and OpenGL backends. Cg is used for actual shader compilation.
I have very simple cases working. For example: Read the rest of this entry »
Posted on 2009-05-07 23:35 in gpu, rendering, unity | 9 Comments »
It came in as a simple thought, and now I can’t shake it off. So I say:

Ok, now that the controversial bits are done, let’s continue.
Read the rest of this entry »
Posted on 2009-05-05 14:59 in gpu, rant, rendering | 14 Comments »
A couple of weeks ago Google announced O3D: an open source web browser plugin for low level accelerated 3D graphics. The website for O3D project is here.
Of course this created some buzz (hey, it’s Google after all). And it is in some way a competing technology with Unity. I think it’s going to be interesting, so I say “welcome competition!”
Preemptive blah blah: this website is my personal opinion and does not represent the views of my employer, former employers or anyone else other than myself.
Unity is one of the players in “3D on the web” space. 3D graphics in the browser are in fact nothing new. Unity’s browser plugin has existed since 2005 and is now in eight digits installations count. There is VRML, X3D, Adobe Shockwave, 3DVIA/Virtools, software rendering approaches on top of Flash and so on.
In my view, major advantages that Unity has compared to O3D:
- It’s not only about the graphics. Unity has physics, audio, input, scripting, streaming, networking, asset pipeline and whatnot. O3D is only about the graphics, and at a lower level.
- Unity runs on wider range of hardware. O3D requires Shader Mode 2.0 or later hardware, so about 30% of the “machines on the internet” can’t run O3D (based on our 2009Q1 data). Couple that with lots of compatibility workarounds that we have and it’s probably safe to say that Unity is more stable and mature at this point.
- Unity is not only about the web. There’s support for iPhone, Nintendo Wii, standalone games, and with time more console and mobile platforms will come.
- Creating and improving Unity is our primary and only focus as a company. In Google’s case, O3D is just another technology in their vast portfolio.
Of course, O3D also has advantages:
- It’s done by Google! When Google does
something anything, people notice immediately :)
- O3D is free and open source. Hard to beat the free price, and open source does have it’s benefits. O3D is not a “standard” of any sort right now, but it looks like Google would want it to become one.
- Only focusing on low level graphics has it’s benefits: it’s lightweight, it appeals to hackers and graphics programmers who want to be in control. Unity’s higher level is much easier and faster to use, but low level hacking can be fun.
Of course there are tons of other differences (I might have missed something important as well).
For me as a rendering guy, it’s interesting to see O3D taking similar decisions here and there (e.g. they don’t use GLSL on OpenGL either because it does not really work in the real world).
So… we’ll see where things will go. It’s going to be interesting!
Posted on 2009-05-05 14:01 in rendering, unity | 5 Comments »
Here, ryg nails it:
why would you want sound and physics when you can have sparsely clothed ninja space marine amazon secret agents riding on chainsaw-hoofed flying pink stealth space unicorns through a brightly colored dystopian african urban jungle fantasy wasteland island state populated with mutated propaganda-spewing gas mask-wearing alien nazi zombie demons that entered this island planet dimension through a hellgate portal invasion triggered by a black magic freak teleportation experiment resonance cascade accident caused by a power-hungry mad scientist wizard evil genius working for a multinational corporation conspiracy of lawyers and weapons manufacturers without morals, and all that in its proper realtime dynamically lit globally illuminated deferred-shaded parallax-occlusion-mapped ambient-occluded shadow-buffered high dynamic range silky smooth glory?
Pretty much sums up the mainstream game industry!
Posted on 2009-04-03 7:36 in games, random | 3 Comments »