|
|
Archive for 'rant'
Most of the time, yes, you can just set the needed states! You can set alpha blending on and turn light #0 off, and often nothing bad will happen. Blending will be on, and light #0 will be off. Fine.
Until you hit a graphics card (quite new – from 2006, it can even do pixel shader 2.0) that completely hangs up the machine in one of your unit tests. In fact, in the first unit test, that does almost nothing. Debugging that thing is total awesomeness – try something out, and the machine either hangs up or it does not. Reboot, repeat.
After something like 30 hang-ups I found the cause: you are damned if you set GL_SEPARATE_SPECULAR_COLOR and GL_COLOR_SUM to different values (i.e. use separate specular but don’t turn on color sum). Because, you know, some code was there that did not see a point in changing light mode color control when no lighting was on. So yeah, always set those two in sync. Just to please this card’s drivers.
It’s hard for me to have any faith in driver developers. I know that their job is hard, walking the fine line between correctness and getting decent benchmark scores… But still – hanging up the machine when two OpenGL 1.2 states are set to different values? Would you trust those people to write full fledged compilers?
Posted on 2007-07-25 22:50 in opengl, rant, work | Comments Off
Aaargh! Well, the blog title is about as much as I wanted to say on this topic.
…this is just me venting out, during the process of chasing a video memory leak for 4 days already. It involves p-buffers, depth textures, shared OpenGL contexts and other delicious things. Still didn’t find the cause, but I’m getting close.
Pbuffer my a**.
Posted on 2007-06-04 18:22 in opengl, rant, work | 1 Comment »
I’m always puzzled why people think that some interesting effect is “shaders”. The most recent example I saw is this message on Dir3d mailing list – it’s about NVIDIA’s skin rendering demo (*).
The most interesting effects are in fact not achieved by the use of shaders – rather it’s the complex interplay of render-to-textures, postprocessing them, using them somewhere else, postprocessing that, using them somewhere else again, combine the intermediate results in various interesting ways, and finally get something that represents the colors on the screen.
So the effect is much more than the shaders; it’s more like “an orchestration of different stuff”. It’s the shaders, textures, models (often with custom data that is required for the effect to work), specially precomputed textures (more custom data for the effect), multiple render textures to store intermediate results, and finally some sort of “script” that controls the whole process.
Shaders are (relatively) small, isolated thingies that operate on small, isolated pieces of data. So they are only a small part of the whole picture, and in fact often they are the easiest part. Both to the effect author, and even for the “engine” to support.
Adding “shader support” to the engine/toolset is a piece of cake. The hard parts are:
- How shaders integrate with the lighting? Once you start doing shaders, you lose all lighting that used to be computed for you.
- How shaders integrate with various data the mesh may have or it might not? For example, to support per-vertex colors you either have to write a single (sub-optimal) shader that always assumes vertex colors are present, or write multiple shaders: when vertex colors are present, and when they are not.
- How shaders integrate with … lots of other things that were taken for granted in fixed function world. Scaled meshes. Various fog types. Texture transforms. The list goes on.
- How do you expose the rest of the “stuff” that makes interesting effects possible? Shaders alone are nothing. You need render-to-texture with various interesting formats. You need to store custom data in the meshes. You need to store custom data in the textures, in various interesting formats. You need custom cameras to render intermediate results into render textures. You need a way to replace object shaders with some other shaders so that these objects can render these intermediate results. The list goes on.
- Hardware support. Once you enter shader world, you get a totally new set of inconsistencies between operating systems, graphics APIs, hardware vendors, graphics card models and driver versions. And a new bag of driver bugs of course.
So shaders do present three big challenges.
1) Shader explosion. How do you do lighting? Do you say “there shall only ever be a single directional light” (that is what most tech-demos do)? Do you try to support the general case and write some dozen shader combinations? How do you handle all other cases that were “just handled” by fixed function pipeline? Vertex formats, fog, texture transforms, etc. Congratulations, multiply your shader count by 10 or so. Or don’t multiply the shader count, but use static/dynamic branching if you have hardware support for it.
2) Platform differences. How you write shaders in the general case, when some things don’t work on AMD cards, some other things don’t work on NVIDIA cards, yet some other things don’t work in OpenGL, some other things don’t work in Direct3D, and something entirely else does not work on Mac OS X (with different things not working on PPC vs Intel, yay)? Congratulations again, multiply your already large shader count by 10 or so.
3) Shaders are just a small part of the equation. You need the whole infrastructure around them to actually enable those interesting effects.
To return to the original message about the skin rendering demo: no, “just shaders” won’t enable that. You need render textures in several formats (color & depth) at least. And some dozen shaders to do the effect for a single light type, for a single mesh configuration, and for a single hardware platform. Multiply the shader count by, hmm…, hundred or so to cover the general case.
Real life is harder than a tech demo. Real life is more than just the shaders.
(*) I’m taking the message out of the context on purpose. Nothing is wrong with noisecrime’s message, I just want to point out that just exposing shaders does not get you very far.
Posted on 2007-05-07 17:17 in rant | 9 Comments »
Ok, I got an USB memory stick (PQI something). Now it has two partitions on it by default, one of them to store some sort of “USB Notebook” data. I am pretty sure I really don’t need that, so I was looking around for a way to merge those partitions. I ran this “USB Notebook” application in a hope that setup wizard will let me choose “no thanks, I don’t need this stuff”. Of course, it does not have such an option.
Pressing Cancel somewhere in there results in this dialog:

Pretty cool, I must say. Some advice I’d like to give for the application developers, if I may:
- Instead of trying to copy Aqua’s GUI, make the application actually do useful things. “I don’t need your stuff, please give me a single partition” is a pretty common use case. And please don’t make error messages like that be the topmost windows (now it stays on top even when I switch to another app).
- Either get someone to write English messages, or leave the message as is and change the caption to “All your base are belong to us”. For such an exciting error message I’d also change the button text to “YES!!!”. Let the user enjoy your software!
From the software manual: “Thanks a lot to you that are use our company’s product”. Gee, thank you that you are use your software on me!
Posted on 2007-04-03 11:48 in rant | 2 Comments »
OpenGL vertex buffer functionality, I mock thee too! Why couldn’t they make the specification simple&clear, and then why can’t the implementations work as expected?
It started out like this: converting some existing code that generates geometry on the fly. It used to generate that into in-memory arrays and then Just Draw Them. Probably not the most optimal solution, but that’s fine. Of course we can optimize that, right?
So with all my knowledge how things used to work in D3D I start “I’ll just do the same in OpenGL” adventure. Create a single big dynamic vertex buffer, a single big dynamic element buffer; update small portions of it with glBufferSubData, “discard” it (=glBufferData with null pointer) when the end is reached, rinse & repeat.
Now, let’s for a moment ignore the fact that updating portions of index buffer does not actually work on Mac OS X… Everything else is fine and it actually works! Except for… it’s quite a lot slower than just doing the old “render from memory” thing. Ok, must be some OS X specific thing… Nope, on a Windows box with GeForce 6800GT it is still slower.
Now, there are three things that could have gone wrong: 1) I did something stupid (quite likely), 2) VBOs for dynamically updated chunks of geometry suck (could be… they don’t have a way to update just one chunk without one extra memory copy at least), 3) both me and VBOs are stupid. If I was me I’d bet on the third option.
What I don’t get is: D3D has had a buffer model that is simple to understand and actually works for, like, 6 years now! Why ARB_vertex_buffer_object guys couldn’t just copy that? The world would be a better place! No, instead they make a way to map only whole buffer; updating chunks is extra memory copy; there are confusing usage parameters (when should I use STREAM and when DYNAMIC?); performance costs are unclear (when is glBufferSubData faster than glMapBuffer?) etc. And in the end when an OpenGL noob like me tries to actually make them work – he can’t! It’s slow!
Posted on 2007-03-22 23:51 in opengl, rant | Comments Off
Awards: Hey, we‘ve got a “runner up” award in Apple Design Awards 2006, Best Use of Graphics category! Yeah, a runner up is more like “the first of the losers”, but oh well. Got beaten by modo 201, which probably is a fair trade. It’s just that we thought we’d be in Best Developer Tool category, but that is apparently for text editors and scripting languages :)
Demos: In the other news, fellow ReJ with TBL just won Assembly 2006 demo competition with an Amiga demo, putting all PC demos faces’ to dust. Check it out. Art direction over hardware capabilities, one more time.
Drivers: why oh why the graphics drivers must be so bad? The other day I was thinking why can’t they auto-update themselves (with an option to turn it off for corporate users etc.). Now you’ve got a (not so recent!) driver that is able to parse vertex programs wrong, and a user who does not have a clue that he should update it. It’s bad enough to have a bug in the first place, but auto-update at least would fix…
Or you have a driver that says “I’m OpenGL 1.2!” but the 3D texture functions are null. And it’s the most recent driver for a particular graphics card that you can buy today! And it’s not even a hard problem! What the developers are thinking – they go over the required GL 1.2 functionality, see that some is actually missing and decide “ah, screw it, we’ll say it’s 1.2 anyways”?!
I just don’t get it. I could use some enlightenment on this.
Posted on 2006-08-14 0:24 in demos, opengl, rant, unity | 3 Comments »
Getting multithreaded code right is just so damn hard. Reasoning about it’s behavior or correctness is even harder! We’ll be doomed until we get something of much higher level than threads and locks.
Why I’m writing this? Because my head hurts from trying to make the renderer run in one thread, and the containing application in the other. With added spice that most (win32) GUI stuff must happen in one thread, OpenGL contexts can only be active in a single thread, simple functions must be split into complex chains of inter-threading calls, etc. etc. The result is a mess that nobody can understand.
I hope I’m not missing something obvious (well, aside from the suggestion “just don’t use threads”).
Posted on 2006-03-27 11:20 in rant | 5 Comments »
The company I was working at for some three years, closed it’s offices in Kaunas recently. Well, it was almost a year when both intera and motion parts of the name didn’t already make any sense… At start we were doing computer vision, various game/graphics/entertainment stuff, but in the last year all development was about some computer networks management system. A couple of programmers will stay for some time to support existing systems, but afaik any new development is suspended.
I feel kinda sad, even if I blame the management for the failures mostly (we programmers never blame ourselves, you know :)). Yes, I/we could have worked harder, done better etc., but all the way I (and probably ‘we’) felt that the ambitions were too unrealistic*, the business plans were too non-existant, the management was just a bit too poor, and some forward-thinking was ‘just a bit missing’.
I guess that’s just my attempt to transfer blame to someone else :)
That said, it’s still sad. Oh well, just keep going on.
* Ambitions: “by that time Sony, Nintendo and Konami will be years behind us” doesn’t sound very realistic, does it? :)
Posted on 2005-09-14 19:57 in rant, work | 1 Comment »
After taking a break, I already want to do something programming-related in my free time. What should I?
- The standard thing: do a demo. I have some ideas for that, but for various reasons I’m not in the mood right now to start a big/long project.
- Read some books. I’m doing this a bit.
- Learn something. Do something with wxWidgets or some Lua-only programming, but didn’t start anything yet.
- I already should do something related to the next version of Project Hoshimi for Imagine Cup 2006. I’m trying to!
On the unrelated note, I’m doing a Oracle and XSLT related project at work. While Oracle stuff I’m dealing with really sucks, XSLT isn’t bad at all. Sure, it’s not “programming” that I’d love very much, but the whole concept is very powerful.
Maybe XML isn’t such a bad thing afterall, especially once you start doing funky things with XSLT and XPath. I still love the quote “XML is a giant step in no direction at all” though :)
Posted on 2005-08-30 16:09 in demos, random, rant | Comments Off
It’s never too early for Software Of The Week awards, even if it’s only Tuesday. Ladies and gentlement, Aras’ picks are:
- Software That Rocks award goes to TortoiseSVN and PmWiki. Both are slick, sexy and do not try to annoy you. They actually work (that’s already something!), they do not crash whenever I do just-a-bit-non-usual action, they do not corrupt my files behind my back.
- Software That Sucks award this week goes to Oracle Reports and Designer 10g. Sorry dear Oracle, but the best description I have for those is “Ugh”. For a longer description, just invert everything that’s written in the first point.
See you later!
Posted on 2005-08-23 18:45 in random, rant | 3 Comments »
|