Home » Top Secret » Thinking out loud on development tasks

Thinking out loud on development tasks

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 46 other followers

I’m currently working on the color and lighting of the start menu and trying to achieve a chrome/stainless steel like effect with a cylinder standing on it’s edge and a sphere.



Now the frustrating problem is there are two primary types of lighting in OpenGL. One, material lighting, the other, external light sources. And with these two primary types of lighting come secondary lighting adjustments to make: Ambient Lighting which ‘sets the uniform color’ of a scene, diffuse lighting which is like having a light bulb in a room, specular lighting which is like having a spot light.

There’s also emission lighting, which is how much light an object gives off.

Now here’s a pretty profound image which demonstrates the effect lighting can have on a 3d model:


So for a 3d model, lighting is HUGELY important.

Now add into this the model’s position in x, y, z space and the light source(s) position(s) in space, and the effects can vary.

So here’s what I am grappling with for design in a nutshell:

One primary goal of my 3d system is to make sure it’s flexible and dynamic enough for making high quality CGI without green screens. Put specifically, given a movie or tv show or still, I set the light sources, provide my model(s), and my render occurs on a frame by frame basis – dynamically.

So for instance. Let’s say I have this image of me where my hair was still long:


Now I can count at least 8 primary ‘light sources’ on this scene above. There’s the 6 ceiling lamps. There’s the lamp hanging on the right. And then there’s the light illuminating me.

So now. Let’s say I want to insert the 3d Q into this scene using my paint program…


In the end, after I have cropped out my paint program’s borders, I have this quasi realistic looking image:


Now here you can start to see the problem with lighting. But I’ll shift that Q to the right, and I’ll see the problem a LOT more.


Despite the hard edges of the model the problem is the light sources. There’s absolutely no realism with the light sources.

Not the least of which is I’m new to all of this.

Now while I have found direct application to work on my light sources. Creating funky fun images with 3d objects embedded in them, which will look brilliant when I get textures working…

But this leads me to the current design.

Right now I have a SCENE class which I intent to contain everything there is to a scene, much like Hollywood does. This ‘container class’ has four primary methods. Again much like Hollywood – “Lights” (which has an implied ‘quiet on the set’) which turns the light sources on or off, “Camera” which sets and locates the camera(s) in a scene. For now it’s only supporting on camera. And then there’s action which grabs the frame. And then there’s ‘cut’ which sends it all to it’s ‘at rest’ state.

There’s a Model class. The “Q” above as a static model loaded from disk is loaded into the Model class which allows the interactions with that model. Here is where I set textures and colors of the model…

Talking this through helped me realize I need to shove material and model level lighting considerations into this class and abstract it from the scene.

Put specifically – as I typed that – I realized the lava lamp is it’s own light source. It’s both a model and a light source.

In addition to light sourcing, the model also contains positional and rotational information (I am here…. )

And will contain animation information.

Now finally I am introducing the light class. Which is where I will set the 8 different light sources.

The ‘final’ deliverable for this all is a workable CGI/Game engine based on methods of interaction which make sense to me, since most game engines and 3d engines are nonintuitive and tend to require training.

And let’s say I move that object around the scene. even though it’s static, the light sources will effect the model as the model moves through the scene.

The effect should be pretty sweet – especially for ‘stopping time’ CGI animation. No longer does an actor have to hold a pose while another actor walks around him. Instead, Use this software, and ANY CGI model can wander the scene and actually have realistic looking light reflections.

So what’s this mean for my design and current tasks?

I almost back tracked today and created an MFC C++ project called “Q’s OpenGL Controls”, in which I’d planned on making a series of LCARS controls which could be imported into Visual Basic 6.0 . This would make for a REAL easy way to quickly build User Interfaces with the LCARS design, but introduces a few major problems right away.

The problems? MFC  – I dont want it as an external dependency. The second – Visual Basic will ultimately cause problems working with C++ and the transprency’s which are the bedrock of my work. And finally. 16 bit code dependency. Visual Basic 6.0 is 16 bit. I can compile a 32 bit OCX. But since I’m using 64 bit in everything else I do, why take that path?

Naw. I’m sticking with it.

So here’s what’s on the slate:

Go back to the paint program.

Add in these features:

  • Add in directional and rotational controls (x,y,z) on left bar.
  • Add in label for objects (to allow for selection)
  • Add in light sources for material.
  • Add in light sources

While doing this:

  • Refactor Scene class
  • Refactor Model class
  • Add in Light class

Committing this to Microsoft Project with the rest of the goodies on the list, the pain area of things has changed substantially. Rather than being a 3d paint program, it’s a scene painter. Leave the 3d object manipulation to the other packages. I like where it’s going with this development:


Now as I am refactoring – I need to consider how to manage animations, and how this scene painter can interact with other applications I create to create the final product, a merged scene, particularly if adding CGI to a video feed.

Consider news casts and sports – as they add in as a post process some CGI – such as painting the line on a football field and newscasts doing weather. Eventually it would be cool to have a real time commentary like this available with a finite set of stock objects which can be selected by the commentator and can be added quickly to a live video feed dynamically.

This will clearly evolve ‘to that’. But for moviemaking as a first, HOW will I staple an object to a scene?

Doing it to a still image is easy. It will default to transparency

So I am adding that to the list…

  • Add in still image import for background image….

But how do I make animation sequences for multiple objects on a static video quick and easy?

AND. Shadows… Should I implement that with the lighting?

Things to ponder…

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.