mduffor

From my squishy brain to yours.

HERE BE DRAGONS...

Welcome to my little corner of the web where I open up my brain and see what falls out. My name is Michael Duffy, and I spend way too much time thinking about computer graphics and how to push around little points of light. This blog is meant as an outlet for my ramblings.

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Building the bricks so I can make a house

Posted By on March 3, 2010

I’m falling into the bad habit of not wanting to make a blog post until I have something significant to show.  However, since progress is slow when you are working on the basic engine that sits beneath the game, and I don’t get a lot of time to program anyways, I wind up not posting at all.  And that is bad.

So here’s my attempt at posting more, even if the updates aren’t earth-shattering.

Test sprites, lines, and fonts

Test sprites, lines, and fonts

The above image is one of the test pages for my engine/library.  Here I’m testing simple drawing primitives (lines, rectangles, xor’ed rectangles, setting draw color, sub-canvases, checkerboards, TGA file reading, sprite encoding, sprite display, reversed sprite display, clipped sprite display, solid sprite display, clipped solid sprite display, etc. etc.)

I’m also testing out my bit-mapped font display routines, displayed as both simple rectangle copies per glyph and sprite encoded glyphs.  The advantage of encoding one’s own fonts is that you have a lot of control over how the glyphs look, and don’t have to worry about certain fonts being installed on the target platform.  The downside is that it makes supporting porting to languages like Japanese, Chinese, and Korean much more difficult.  Ah well, I’ll cross that bridge when I come to it.  Once upon a time I worked with Shift-JIS, bitmap-encoded Japanese fonts in the days before Unicode, and I’m sure I can pull off something if need be.

In the lower right hand corner are a couple of buttons driven by the new Immediate Mode GUI library.  Many years ago I wrote a GUI library which saw light of day in games like Business Tycoon and the original version of Galactic Civilizations 2, and I’ve been salvaging what I can of either code or ideas from it to build the new IMGUI library.  It is actually simpler to develop my own Widget library than to try and use an existing one, and it will again give me complete control over how the interface looks and responds.  It also makes the code very portable across platforms (Win/Lin PC, Mac, Pandora, Nokia Internet Tablet, netbooks, etc.) since I just need a surface to draw on and I’m good to go.  Also it will be possible to display the widgets through 3D surfaces in the future if need be, though the game engine is currently only 2D.

I’ve also been busy with the scripting engine.  I overhauled the old C-syntax scripting language I wrote for an RPG engine a decade or so ago, and brought it up to integrate with my modern code base.  I’m combining ideas from C, C++, and Python all into one language, and with the tight integration with my world representation / scene graph, it should suit my purposes nicely.  I also wanted to write my own scripting language rather than using Python or Lua or somesuch, so that I could make sure the syntax and flow works exactly how I want it to.  (Do we see a theme developing here?)  Also I wanted to insure maximum portability and minimum external dependencies in my code.

I’ve also been working on a dialog script parser, that is similar to the script parser in RenPy.  RenPy’s dialog scripting approach made a lot of sense to me, so my own dialog scripts are… errr… heavily inspired by it.  This is the code that currently has my focus, and I hope to be driving a dialog interface with the code before too much longer.

So there you have it.  Lots of individual bricks have been built, but there’s no house yet.  I haven’t started on any art or story yet, so my Visual Novel is lacking both visuals and a novel.  All that will come in good time… I just need to get around to building the house!

Ten Things to Make Your Renders Suck Less

Posted By on January 29, 2010

I made a posting over at CGTalk recently, and it seems to be useful to a lot of people.  I’m reproducing the suggestions here for your viewing pleasure. 🙂

1) Motivate your lights – As much as possible, every light in your scene should have a logical source to it. Is your key light coming from a lamp? a window? the sun? Sure you’ll wind up cheating the position and intensity of lights a bit for a better look, but try to keep them logically consistent

2) Don’t be afraid of the dark – Too much CG is over-lit (high key lighting). Let parts of the scene be under-lit, or drop into near black. You still want some shape in your dark areas/shadows, but it can be just the suggestion of forms. If you know an area will always be in near darkness, this is also an opportunity to save some time an not model/texture everything in this area to a detailed level.

3) Dark scenes do not mean under-exposed scenes – If you have a night-time scene or a dark interior scene, don’t just turn down the intensity of all the lights and call it a day. Drop the intensity of your fill, and even cool your fills off with a blue tint, but keep some elements of your scene properly lit. A character that is lit from the side (or slightly from behind) with a full intensity key and then darker fills will look better than a character that is more front lit but with the key turned way down in intensity

4) Depth of Field – We are used to looking at images taken by a camera, and camera lenses are unable to keep everything in focus at once. Items that are too near or too far from the focal point have softer focus. This can be done in 3D (slow to calculate) or 2D (faster, but with more artifacts that have to be worked around). Also remember that you need to use a circle/bokeh blur, not a gaussian blur if you are doing this in comp.

5) Keep your light sets separate – In real life, you often have to light your actors/subjects with at least some of the same lights that light your environment. But as a result you wind up having to set up all sorts of flags, diffusers, barn doors, scrims, etc. in order to keep the light at one intensity for one object in frame, and another intensity for other objects in the frame. If you separate out your environment and your subject where possible and light them with different sets of light, then you have more control over the lighting of each element. Each of your characters can be lit with their own set of lights as well. Most CG films I’ve worked on have a set of lights (key, fill, a couple of rim lights) for each character, and these lights are constrained to the center of gravity/placer of the character and move with that character (but don’t rotate.. they stay aligned to world space). This gives you a lot of control over each character’s lighting, and you can adjust one character without affecting the others. Also by rendering characters separately, you save a lot of time when you are tweaking lights. Then the characters are put together in the compositing program to create the final image.

6) Learn to use a compositor – Whether you are using Photoshop/Gimp for still images or Nuke/Shake/After Effects for image sequences, you should learn to use a compositing program. It is much faster to make color corrections, blur edges, fix render artifacts, adjust fog/atmosphere/fx-levels, adjust reflection amounts, etc. in 2D rather than tweaking settings in your 3D package and re-rendering. The faster you can turn around and see the results of a change/tweak, the more interations you can perform in a given amount of time. The more iterations you can pull off, the better you can make your art. This also ties into the above suggestion that you render layers separately so that a tweak that affects one element doesn’t require re-rendering them all. Don’t get caught up in trying to get perfect renders out of your 3D package. Get useable layers out of your 3D package, your 2D package, your particle engine, etc, and then blend them together in your compositor.

7) Linear Workflow – As others have mentioned, linear workflow is very important when you want lighting that you can control. Others have covered the how and the why of this elsewhere, so I’ll only mention it here.

8) Composition – Likewise, I’ll echo the sentiments of others and stress that image composition is very important. Make the meaning of your image clear. Light and compose to focus on your subject matter. Remove distractions from elsewhere in your frame. Especially if you have moving images, and your audience can only focus on the image for the few seconds (or fraction of a second) that it is on-screen, you want to focus attention and remove distractions so that your intended message comes across.

9) Calibrate your Monitor – If you have access to colorometers that can be used to adjust the color levels, brightness, and contrast of your monitor, then do it. Otherwise there are test images and procedures out there (Google is your friend), that will help you at least get your monitor somewhat close to calibrated. I’ve run across several renders that were too dark, and the reason turned out to be that the artist had the brightness on their monitor cranked soo high that they were able to see the image, but it was way too dark for everyone else.

10) Atmosphere – One of the things that make CG images look very CG is that their color stays the same across vast distances. In real life (assuming you are on a decent-sized planet’s surface) you view distant objects through a lot of air. This air has color and opacity that blocks/scatters the light moving through it. So if you are looking at objects more than a few meters away, you should add some sort of atmosphere to your render (usually best done in your compositing package). Render out a depth-from-camera pass (z-depth), bring it into your comp package, adjust the values with expand/gamma/curves, multiply it by your fog color, and add it back in on top of your image. This additional atmosphere really helps to sell that your image exists in the world, and gives it a sense of depth.

There, hope that helps in a constructive way. 🙂

Cheers,
Michael

Star Blazers!

Posted By on January 4, 2010

Ok, how cool is this?  It looks like in Japan they are making a live-action movie for the manga Space Cruiser Yamato.  The anime version of this show aired in America back in the late 1970’s under the name Star Blazers.  I remember rushing home from elementary school so that I could catch it on TV (well, rushing home as fast as I could considering I was riding the school bus).  Man did I love this show as a kid! I can’t wait to see the finished live-action movie.

Welcome to 2010

Posted By on January 1, 2010

I really did have the best intentions of blogging in 2009.  Honest!  But a change of jobs, trans-Atlantic move, stricter contract, and birth of my daughter all conspired to keep me pretty quiet on the internet this past year.  Well, here’s hoping that changes in 2010.  The safe money is on my updating this blog a few times and then disappearing into the woodwork for months on end.  But I’m not much of a betting man, so I’ll move forward with wide-eyed over-optimisim and plan on updating this blog every couple of weeks at least.

And what, pray tell, am I going to be writing about?  Well, my aspirations towards creating my own indie film are on hold due to a conflict of interest with my present job.  Since I like my job, and want to keep it, my film is mothballed for the time being.  In the meantime I continue to develop my skills as a filmmaker and CG artist as part of my job, and I will put them to use on my own film project some day in the future.

In the meantime, I am dusting off some of my goals from before I got back into film.  This year, I’m going to be working on a computer game.  I’ve started dusting off some of my code from the Studio Blue days, and integrating it with code that I developed in more recent years.  It is a very odd feeling to open a file of code to start updating it, and realize that you haven’t touched the file in the past 12 years!  The tires needed some air, and I had to knock some cobwebs out of the corners, but my old code is transitioning to the modern age fairly well. I only get about an hour a day to work on it (half an hour during the morning train ride, and then half an hour on the way back home), but progress is being made.  Slow and steady wins the race, doesn’t it?

So exactly what type of game am I going to be working on this year?  Well, many years ago I played a game from Japan called Princess Maker 2.  It has been translated into English, but never released due to a complicated licensing problem.  It is an interesting game where you guide the life of a child put in your care through ages 12 to 18 in a fantasy world.  The game ends on the protagonist’s 18th birthday, and you achive one of several possible endings based on how well you did and what choices you made during the game.  I found this facinating because gameplay consisted of developing a character and evolving a story, rather than running around a map and beating up countless enemies like you see in most RPGs (though to be fair, there are parts of PM2 where you run around a map and beat up baddies).  This game was part RPG, part Tamagotchi, and part Visual Novel.  And to top it all off, a game only lasts 2 or 3 hours, allowing the player to more easily complete the game arc in a single sitting.  Since my own life has become very busy and I don’t have 40 hours to dedicate to a single game, this style of “short play time, but very replayable” game strongly appeals to me.

In the years since I first Princess Maker 2, a few other games in this “life simulation” category from Japan have been translated to English, though usually for the console market.  There have even been some indie games developed in English that carry on the spirit of the Princess Maker style of gameplay, including Cute Knight, Cute Knight Kingdom, and Spirited Heart.

My goal is to develop a worthy addition to this genre.  Rather than playing the adoptive parent of the protagonist as in other games of this genre, you will play the main character himself.  Gameplay will focus on developing the character and story, and moving through the story arc over a few years of the character’s life.  It should be possible to play through an entire session of the game in 2-3 hours, but multiple endings should keep replayability high.  Interaction with other characters in the game will be a key factor in achieving one ending versus another. I will be coding the game engine myself in C++, utilizing the code base I’ve developed over the years.  I also plan to do most or all of the art myself, which means I need to start brushing up on my drawing skills!

A long journey lies ahead.  I’d be lucky to finish this game up within the next two years, especially considering how my family and my job hold the highest priority on my time.  But I will chip away at the project bit by bit (byte by byte) and try my best to keep a record of my progress here.

And away we go….

Testing, testing, 1, 2, 3….

Posted By on December 11, 2008

Well, I figured it was time for me to re-establish a web presence on the internet.  My past websites have long since expired, and as I was job hunting this time around I discovered just how useful it would be if I had a place to show off my work.

Of course most of the work that I do is behind-the-scenes and never directly shows up on-screen. So this blog is my way to take what is in my head and spill it out for all to see.  Whether or not anybody but me actually finds the stuff in my head interesting is yet to be seen, of course.

So what are my plans for this blog?  Well, my ultimate goal is to produce indie CG films by myself or with a small group.  This involves a lot of planning on the technical side to make it feasible.  And (ideally) I am employed full-time in the computer graphics industry, and have a wife and son at home who I love coming home to everyday.  So with work and family taking a priority, my little side project of world domination always takes a backseat by necessity.  This blog is a way for me to keep the fires burning on my side project, and encourage me to learn new things.

My basic thoughts on pipelines for computer graphic films is that they get too complex.  They get too complex for a single technical person to understand all the ways the parts interact with one another, and they get too complex for the artists to truly understand what comes before and after their bit of work.  So my goal is to simplify CG production as much as possible.  This blog won’t be the place to find the latest and greatest technology in computer graphics.  Most of the topics I will talk about will have been around in the computer graphics community for years, if not decades.  It will however hopefully be the place to explore the basics, the absolute core of what is needed to put a cg film on screen.  And by focusing on just the basics, I hope to explore ways to make cg production faster and more efficient.

I also hope to draw attention to some of the indie CG productions currently in release, or in development.  I hope to share some of my own ideas on what I think works and what doesn’t.

But most of all I hope to just have fun with the blog, and have fun exploring some topics that interest me.  Maybe if I’m lucky I’ll get some pretty pictures out of the endeavor.  Maybe I’ll be so boring that my site can help cure insomnia.  I guess we’ll just have to stay tuned and see.