I’ve been fiddling with 3D with the goal of implementing Shadow Mapping for almost a month now.
I spent quite a bit of time around the engine, ironing things, getting it ready to quickly plug-in shaders.. and now I’ve been stuck on the facking Shadow Mapping for several days !
In theory it’s nothing special, in practice 3D graphics sometimes really sucks !
The problem is that there is a general concept, a lot of half-assed implementations, many ambiguous discussions on the net, a million papers and books that focus on different details. But no real complete reference. This is for Shadow Mapping but also for many other things.
The main issue with 3D graphics is that one works with transformation matrices and different 3D spaces. Matrix manipulation is not that difficult, but millions of ambiguities raise with coordinate systems, order of concatenation, inversion of matrices… plus the fact that shaders are hard to impossible to debug.
Doing an actual implementation is a royal pain in the ass, and it’s especially sad that I tend to try solve by trial and error. Flip matrices, swap orders, try to do something like some reference implementation does… but never actually really being sure what details am I missing.
For example I saw some code arbitrarily adding w to (x,y,z) to the light-view homogeneous space vertex after being transformed in a shader. Why ?! Why the fuck ?! ..nobody knows, there is no telling. It’s something that needs to be done because of the specific situation.
I hate feeling stupid and fiddling for hours with parameters. Trying to grow a working implementation out of web-searches.
It doesn’t help that I still don’t have a credit card to buy English books via Internet, and the best library with English books I knew here in Tokyo seems to have given up on carrying the good coding books. Of course one can find a lot of shit on how to use Office and code in Perl and Ruby.. but who the fuck needs those ?! I need my 3D books !!!
…but I also know that to get something to work one needs about 10 books treating the same subject. That has always been the case, but more so now that there are tons of Game Programming Gems, GPU Gems, ShaderX. All written by hundreds of people.
If everyone is so good, why can’t I find a decent explanation on-line ?!
zzzzzzzzzzzzzzzz
Posted by Davide Pasca as Programming, 3D Graphics at 1:54 AM EST
11 Comments »
In 2000 the PC port of Final Fantasy VIII was released. I was in the team that ported it and I clearly remember an outstanding bug for which I damned myself. It was about artifacts coming out of inconsistent subpixel bias across different graphics cards with Direct3D
The game was shipped with that bug.. a couple of weeks later a guy from nVidia told us: “Oh that’s easy you just have to offset all pixels by 0.5″. Easy he said, but in fact when asked about the issue earlier he said something about some other developers doing a a simple test rendering and reading back the buffer to estimate the subpixel bias settings when starting the game.. yuck !!!
Six years later, I’m still struggling with subpixel bias. This time with DSharingu and OpenGL.
To render texture for 1:1 ration pixel display in OpenGL it’s suggested to offset rendering by 0.375 pixels. This looks good if bilinear filtering is disabled, otherwise textures come out blurred.
Also, on my ATI 9700 AIW Pro, to render properly a frame rect with a GL_LINE_LOOP I have to offset pixels by 0.5. If I don’t there is going to be a pixel missing from a corner. This changes with the 9200 SE that I have another computer, which still misses a pixel but on a different corner !
Things get even funnier when trying to draw a small X with a couple of lines. Pixels tend to be missing on either ned of the line depending on more than one variable, obviously including hardware and drivers..
..it’s a rasterization mess !
I’ve wasted a lot of time on this and I’m not sure how to settle it.
My main problem is about text rendering. I build my own texture for text at run-time. It’s fast and looks nice because I subsample myself Windows rendered text so that I can be sure that I have antialiased text. However this doesn’t support Japanese text. To do that I’d have to use a lot more texture memory and implement a Shift-JIS rendering routine.. which is not too hard, but not too funny either.
well well
Posted by Davide Pasca as Programming at 1:23 AM EDT
20 Comments »
Here comes another slow update.
I have potentially a lot to write about but I generally let it go.. I could write so much more.. but it’s better this way, people should get busy doing their stuff rather than read other people’s stuff 8)
First of all, a suggestion (I got from Rasty !) to keep in touch with this blog or with any other blogs: Google Reader. It’s basically a page that groups RSS and Atom feeds. A feed is a streamlined version of a web page comprised of a series of articles. An RSS reader is a page/software that shows all those articles coming from different sites in a single view.
The useful thing in all this is that one doesn’t need to actually bother going to a site to see if something new is up.
This is potentially deleterious though, because one may want people to go to the actual site to see additional content.. but then again, people easily get bored of sites that are updated rarely and would probably end up forgetting a site after a few failed attempts to find fresh news.
Now, about work, I think I pretty much decided. I will go for the company that lets me do research. Research sounds good, but I doubt I will have total freedom.. still ! I like the idea. I honestly don’t feel too much the need to work on a shipping game…. I still get recognition for working with a famous company and so family and friends are set ! That saves also a lot of time for people I meet for the first time and to whom I need to explain where I work at.
Great.. but with all the papers I have to sign and things I have to do (including a medical check !), I don’t want to celebrate until I’m actually hired !
In the meantime I kept working on DSharingu. I finally managed to remotely control my mother’s PC.. and that was really all I was asking for !!
The application has matured quite a bit. It has a few key features that one would expect from a modern application: on-line update, tabbed views, good installer. But also has unique features that make this application so important to me. The most important feature for me is the ability to set the application to keep trying to connect to another PC.
I have a fixed address on the Internet and my mother’s PC can safely keep trying to call me at that address. The minute I need to access her PC, I run DSharingu on my side and accept the next incoming connection (currently tries to connect every 20 seconds). As I mentioned before, this is because she has her connection firewalled by the provider.
The remote desktop’s view is shown using only 4 gray levels. But, frankly, that’s all it’s needed to administer a computer. Still, color will come back at a later time.
DSharingu doesn’t do much more than VNC, in fact it’s probably quite slower and I still have to implement the keyboard interaction.. but it fits my needs as they grow and it’s also a launch pod.
With DSharingu I have an application in place that starts when the PC starts and that can easily be updated. I can now start adding features and easily bring them to my mother’s PC.
Videochat would be nice, but honestly I think that a web-cam feature is more useful. By web-cam I mean a program that grabs images from a video source (usually a cheap camera attached by the USB port) and that sends it over FTP to a web server. The image is then associated to a page that can be watched with ease.
Because of the inherently inefficient method of transfer (sending whole JPEGs over FTP and forcing browsers to reload the image), updates come rarely.
Slow updates are not necessarily bad though. With no animation to speak of, people think of a web-cam as a detached view, something to leave on and mostly forget about… I better be careful with that !!
I started with a hint on how to keep in touch with the blog and I end with a hint on how to update one: use Docs & Spreadsheet from Google !
To post updates I need some minimal HTML code.
I used to use Crimson Editor which is a text/code editor non-WYSIWYG. I tried Wordpress’s WYSIWYG editor but that seems to have a mind of its own and sometimes generates an HTML mess. GMail’s editor works nice but doesn’t show the underlying HTML code, so when I paste into Wordpress’s editor I get plain text.
This Docs seems to work nicely (though not quite perfectly.. I have to go remove a link manually after I’m done writing !), it has a real-time spell checker.
cul cul.. zzzzzzzz !!!
Posted by Davide Pasca as Programming, Diary, work at 6:58 AM EDT
2 Comments »
I’m all geared towards my first day at my new job. I want to go and kick some ass ! ..Sorry for the dudeish expression, but that’s more or less the feeling. I want to go and code new stuff, get tasks, etc etc.
Chances are that my first tasks will be somewhat boring, although I really hope they won’t be ! There is also a fear that I may end up in some place where there is a weird coding standard.
My current employer required (but I never complied (^^;)) that one had to put an underscore before any local variable (WTF ?!), an ‘m’ before every method, and some funky names for looping variables.
for (int i=0; i < 10; ++i)
…becomes…
for (ulong32 _Lp=0; _Lp < 10; ++_Lp)
..give me a break !
My current rules for writing C++ code are the following:
//===============================================================
/// @file class_name.h
//===============================================================
class ClassName
{
int _class_item;
public:
ClassName();
~ClassName();
void PublicMethod();
private:
void privateMethod();
};
..I hope that I can keep that to some extent. Or at least that I won’t be forced to use some very weird and/or paranoid coding style.
Changing topic. I recently received some positive and some negative feedback regarding my search for employment.
The large foreign company that I was aiming for apparently isn’t doing great business in Japan and it’s not looking anymore for new people for the position I applied for. It could be an excuse, but on the other hand I didn’t really have a chance to go for an actual interview after the initial phone chat (which it seemed like it went well).
Positive feedback comes instead from two big Japanese game companies. They both want me to allocate at least 3 hours to undertake an interview and a test.. rigorously in Japanese.
One company says that I will receive help in reading and that I can bring my brand new CASIO XD-ST7400 8)
The other company contacted me directly with an appointed day and hour. So, I will have to ask about the test. If good reading comprehension is required, then I may as well avoid wasting everyone’s time. I don’t like to take tests where there is a good chance that I’ll fail !
I’ve recently worked on DSharingu. A new release fixes a crash problem. But it really needs just a lot of work. I need to improve compression, especially for complicated wallpapers.. but I also need to improve the interface.
Currently the settings allow to specify one party to connect. If one wants to change he/she has to change the IP manually but also change the passwords relative to that destination.
I’m now working on an interface that keeps a list of destinations (or “remotes”), each with a name and a password.
ole’
Posted by Davide Pasca as Programming, Diary at 10:54 AM EDT
7 Comments »
Last saturday I went with some friends to see a Brazilian Samba parade here in Tokyo in the Asakusa area !
Here are the pictures. I made a public album with faces of shy friends removed. To do that I “copied” (it’s shortcut kind of feature) pictures from the private album into the public one. However PicasaWeb seems to lose the order of pictures when doing that, and so they are not in the proper chronological order. Not a big deal I guess !
By the end of September my duties at my current company will be over. I don’t have a next job yet, but there seem to be interest from the companies I was interested to. So far, so good !
I fear interviews as I will have to pull out my best Japanese.. of which I’m not particularly proud. Many times people ask “do you speak Japanese ?”. That’s such a broad question to someone that is struggling to do it. There are many levels and contexts that one has con consider to answer to that question.
On the coding side, I decided to give a try to Google’s project hosting. I’ve started gathering and fixing code that I’ve had laying around, to put it out as open source. That includes DSharingu and the related Pascalibs, a quick name I gave to my libraries for the occasion. I’ve grouped the whole OS coding thing under a new blog which I’m doing with Blogger beta.. just to make sure that I go the whole Google solution 8)
I don’t foresee much activity on this, but it’s nice to have something out there. Nowadays, personal code is hardly much of a trade secret. I’m more afraid to lose it on a system crash than risking to have someone rip off some pieces of my code… but who really wants to spend countless hours to understand somebody else’s code ?!
As far as “love life” goes.. well I remember now what relationships are all about. I remember as a kid I was somewhat forced by circumstances to watch those black and white love movies where the two protagonist are all happy and eventually break up out of some stupid situation and then get together again for good. Boring, but that’s one recurrent pattern. Relationships are a continuum of repeating patterns, an endless script.
My current state of things involves at least one quarrel per week. Spend one day fighting, a couple of days getting back on good terms and the rest is just waiting until the next fight. Most of the times it’s just a word a joke, a thing said with a different tone of voice. Sometimes I make some stupid mistakes.. but I hardly ever get any mercy. I basically have to admit being sole responsible of something and ask forgiveness as I whip my back in pain.
I think that I’m a very honest person but that’s not enough. Actually it’s not a good thing. To have a good relationship, I’m told, one is supposed to tell lies !
Language barrier is also a terrible thing. No matter how good of a thought you have, you are only as good as you can express yourself. But then again, even when language isn’t a barrier, there are so many issues with pride and different points of view.
ehhhhhh
Posted by Davide Pasca as Programming, Diary at 2:08 AM EDT
10 Comments »
Today (Sunday) I finally sent out a few copies of my resume. It took me a long time to get the whole thing right.
Most people kept telling me I was taking too long to write a resume. One problem obviously is that a resume is a rather formal paper and my knowledge of Japanese is very limited.
I had to do a lot of research to find out how technical terms are written in Japanese. Literal translation is generally both wrong and funny. The average native Japanese speaker also will find himself/herself at loss when trying to come up with translations of technical terms or even to describe an technical task. Nevertheless I had native speakers helping me with the process !
I also sometimes tend to get stuck with details, but I think that potential Japanese employers will appreciate that. Form shows dedication. Japanese are sensitive to that and so am I.
With the resume also comes a CD with a couple of demos. Nothing too big, just old stuff that I picked left and right (including JavaKazRace !).. because bringing demos tends to make quite a difference.
I am concerned however… I see that all the job descriptions for R&D programmer in the game business in Japan require the candidate to be not older than 35. I’m 34 and I’m supposed to feel like I’m at the end of my career as a programmer ?!
What is going to happen if, two years from now, I want to go code for another company ? Am I too old for coding ?
It sounds very much like getting in the military. It’s easy to convince an 18 years old to go risk his/her life just to get some action and a decent pay. But later in life, when one has a family to think about, keeping alive and healthy becomes more important.
Game business also requires one to work his ass off, all in the name of fame… because certainly if you want to make money programming you are better off doing Visual Basic and Oracle.
So, I suppose most people by the age of 35, either become managers (difficult decisions but simple work) or they get into other businesses where they trade the fame of doing “cool games” with more money and a more humane schedule.
I just can’t believe that 2 years from now, people will look at my resume and trash it on the basis that I’ll be 36 !!
zzzzzzz melatonin is starting to make effect.. zzzzzzzz
Posted by Davide Pasca as Programming, Society, Diary at 1:58 AM EDT
13 Comments »
On my current 3D engine, I’m supporting both Direct3D 9 with HLSL and OpenGL with CG.
With some effort, I managed to get a hold on the CG interface for OpenGL.. cool !
Then I noticed that Microsoft is starting to push Direct3D 10. D3D 10 seems to make some effort to deal with state changes in an efficient way, and generally to keep up to date with the evolution of 3D hardware, while also removing a lot of ambiguities with the infamous “caps” and forcing hardware manufacturer to include a base set of capabilities on any hardware that wants to be certified as D3D 10 compatible.
cool cool.. what’s uncool is that OpenGL is starting to look very old ! I was once a great supporter of OpenGL, back when D3D was a real pain to use. D3D used to be almost as painful to use as DirectShow (be DS damned in hell !), but eventually grew to become actually more clean than OpenGL.
OpenGL is continuously developed by a committee, which takes ages to implement anything. Implementing a decent off-screen rendering interface took ages. There so so much bureaucracy.. bha ! Its main problem is that it’s stuck with a design thought for a client-server system, where a client terminal makes API calls to a server that renders. We are talking ancient times, stuff that suited SGI hardware (which BTW just recently filed chapter 11.. sad !). OpenGL functions don’t deal with structures, which are sometimes very useful, and don’t have return values, which makes error checking rather painful.
So I’ve been thinking on ditching OpenGL ! (imagine, me doing that !). The only valid argument for using OpenGL is if I want to write portable code for MacOS X and Linux and PS3. But.. that’s pretty much a bunch of horseshit ! The “portable API” is a joke when dealing with advanced 3D graphics. Plus, who cares about MacOS X and Linux ? It’s a geeky excuse. As for PS3.. who knows what sort of extensions does its OpenGL use ? Writing an engine on top of D3D and OpenGL is inevitably going to have to penalize one side of the porting while taking a lot of time to keep the development in synch: not worth it.
ummmmm.. I wrote a lot and it’s late. I actually meant to leave the second part of the update for something completely different. But that will have to go on the next bat-update on this same bat-site !
Posted by Davide Pasca as Programming, 3D Graphics at 2:08 AM EDT
6 Comments »
Things happen, but I don’t report much !
First of all, my dog peed on my futon i_picture_you/DSC00952.JPG. Aibo actually lifts his leg and pretends to pee, from time to time ! He does that very rarely, so it’s always interesting.. actually exciting.. to see that. No liquid comes out, but a tune plays along with the rhythm of an actual leak. As usual, very well choreographed !
I finally saw DJ Tiesto live here in Tokyo. I went with a friend, it was a nice event. I took some weak pictures with my camera-phone while my friend took some better ones with the digital camera that he sneaked in (by virtue of hiding it in his underwear !!). They actually eventually caught him, but as usual, the pictures don’t get erased 8)
I said it was nice, actually it was very nice. Tiesto’s popoularity brought a lot of curiosity and enthusiasm. He mixed from 12am to 4am. And by morning I was very tired. The muscles of my legs were hurting for the next 2 days !
At work I’ve been doing some interesting stuff: 3D ..wow !! Working on both XBox 360 and PC. As usual the engine is developed in parallel for 2 platforms (useful for building tools, etc), but it’s been a bit of a problem because I decided to use OpenGL and CG on PC. The idea is that OpenGL can come in handy, and also CG is pretty much HLSL. But more honestly, I want to be multi-platform, especially I don’t want to be 100% committed to DirectX when PS3 will be using OpenGL with CG !
While CG and HLSL’s syntax is easily interchangeable, the system of passing parameters from the CPU code to the shaders is rather different. I find irritating the fact that one has to re-send parameters to each and every CG program, while with DirectX I can set the per-object or per-material parameters just once on some global registers, without the need to re-feed them for every shader.
In the past few days I’ve been working on some particle system. Trying to come up with some cool explosions. Using the XBox 360’s power to quickly test things without worrying to optimize too much ..eheh ! Doing “effects” is cool, but very time consuming. One enters this loop of changing parameters around, and hours go by, without much being actually done.. just testing different parameters.
At home I’ve been working on my latest videochat-whatever experiment. Working on and off, as usual.. but I already have some stuff going. Using the same framework developed during dsharingu, but with added clean-up. The video-compression part isn’t working yet, but that too, isn’t much of a big deal, as I have all this code laying around only waiting to be refreshed and to be put to use.
I can’t imagine how it would be if I were really starting from scratch. Nowadays there is a lot of stuff that one can grab from the net, but to actually put in place a whole application, one needs a minimal framework made of components known to be working along.
My code dirs are a junkyard, where I constantly go look for how I was doing something one some other program I wrote before.
It’s late, we zzzzz !!!
Posted by Davide Pasca as Programming, Diary at 2:18 AM EST
2 Comments »
Yesterday I released DSharingu 0.4a. Not much has changed. Actually, I spent a lot of time deciding what to put for the icon application. I do have an esthetic sense and I realize that the new icon is between tacky and sad. But I really didn’t feel like spending 4-5 hours trying to get some half-decent icon drawn.
Software development is measured in years-man. If 10 people work on one software for one year, it’s 10 years-man. Imagine one person working on his spare time. By spare time I mean, after work, not considering: laundry, showers, food, entertainment, various errands, learning Japanese, etc etc.
Basically, I’m hopeless as I try to work, have some sort of social life, and program the stuff I like to do.
As much as I try to optimize and reuse things, I just can’t do much. I’m only human. I try to do a billion things but it’s hard. I can generally do a lot, but I often forget things. I fear tests as I could fail them depending on my recent focus on things. My memory is too often wandering around subjects.
But, I swear, I can do great stuff… potentially.
When I was hired to my current company, the idea was: “you are good, we can use your skills !”. Then it became: “I hired you because you were good ! Show us what can you do.. by yourself !” (?!) then “you good ! do this and this for us !”, finally “ok you didn’t automagically poop golden eggs, cook us some spaghetti code that will keep the business going”.
I believe I can do things, but I think that one needs the right space and resources to do anything. With no hints, excessive expectations and no power to direct anything, it’s impossible to meet any goal.
The potential is there, but the problem is that bosses all over the world are generally de-motivated. Once you are up there, once you have your nice car and chicks/family, once your life is pretty much comfortable, you don’t have to prove much to anyone. As long as things go good enough, it’s all fine.
Let the newly hired peeons work for a decent pay while you enjoy your quite nice rewards of being a boss.
That’s bullshit. I want to be in a place where people have constantly something to prove. I want to be with motivated people that will either motivate me, or give me the freedom to motivate others. I’ve got the will in me, and I don’t want it to die off. Mind you, being in the office till late doesn’t qualify to being motivated nor productive.. it’s often just pretending.
I wish I could be financed to do what I feel I can do good. But I’d be already happy if I could work in an environment where people aren’t turned off. People at work should be absorbed in what they do, motivated, excited or at least, very competent.
It’s depressing as I see my career going to the dump. I’m being given a dumb task after another. Moving around software companies in Japan without very good Japanese language skills is not easy. I make it hard on myself, but I still have to learn a lot from Japan and there is still a lot that I want to achieve as a programmer or anything.
I’m alive and kicking, I have the coder’s fire in my veins. I hope I will soon get an opportunity to prove myself.. but I can’t do that alone.
Posted by Davide Pasca as Programming, Society, Diary, Japan at 6:19 AM EST
19 Comments »
I recently went on and removed wxWidgets from the current DSharingu code. I previously looked at that library and decided to avoid it. Recently, I figured that I could give it a second (third) look, since I’ve become more tolerant of C++.
Using those libraries is like believing in UFOs and ghosts. There are so many people that will swear they once saw a flying saucer or a ghost… but when it’s time to prove things real, somehow it just never works.
wxWidgets surely has a lot of work behind, it seems like there is so much support, but somehow it never took off. Basically, it requires quite a bit of learning to do, and it’s not too pleasant as it forces to use inheritance and macros to define event tables.
There is an HTML manual and all, but if one already knows how to do Windows programming, it’s just much easier to continue on that path. It’s so easy to find help on the net for plain Win32 programming, while with wxWidgets one is stuck with limited resources.
Of course, wxWidgets is free, so one shouldn’t complain. However, it’s a bit misleading to read people saying “It was a breeze to switch to wxWidgets, I’ll never go back !” and other bullshit like that.
I think that I can fairly say that wxWidgets is not the way to go. It may be the best existing multi-platform solution which attempts to maintain the host’s OS look and feel… but at what price ? How many people do really need that ?
What finally made me decide to go back was the Settings dialog. With Visual Studio, I’d build one with the resource editor. Very old thing, but does its job.
With wxWidgets, there is more than one attempt at making tools for building dialogs. However, the official and reliable resource editor costs $69 !
I tried to re-build the dialog using the sizers. A sizer is basically an object that helps creating an automatic layout.
It’s a bit like using tables in HTML, but a lot more difficult !
Being sizers objects, new really start coming. Also there is so much function overloading that it’s pretty difficult to get the right parameters hinted by IntelliSense. It can quickly turn into a nightmare, as the number of nested sizers grows.. and then, the layout is still messed up !
Too much effort, too many compromises. It comes to think that all I really wanted to do for the GUI in DSharingu was to put a standard toolbar and modify the settings dialog. But.. I had to go and try commit myself to such a big change.
bha
I now modified the settings dialog. I will add a few more things, test, optimize transmission, and I think that will be it. It can be improved forever, but it’s not something I’m trying to sell, no need for special effects.. just something that works, and then I can start spending time onto something new !
Posted by Davide Pasca as Programming at 4:36 PM EST
No Comments »