Advertisement

Blender model rendering in DirectX with ugly lighting? (Too bright/shadows black)

Started by July 11, 2006 09:17 PM
2 comments, last by ScoobTheNoob 18 years, 5 months ago
Hi all. I'm fairly new to game development (hobbiest), and have been learning how-to & creating 3D models for my game. I initially began learning with Milkshape, but have just moved on to using Blender instead (successfully imported my working model into Blender format). The problem I have is that when my DirectX game rendered with the old Milkshape Model (in .x format) it renders very nicely, with subtle highlights and varying degrees of shadow. However the same model exported from Blender just doesn't render the same. It appears fully bright, except for the shadows that are pretty much total black. This is with no code changes to my game rendering. Just a different .x file. I'm wondering if it's anything to do with the setting of the Material colours in Blender??? When I was learning Milkshape learnt to set the material as follows: - Diffuse = White - Specular = Black - Ambient = White - Emissive = Black Renders nicely in game. So in Blender, I have confirmed that my Material(s) are: - Diffuse = White - Specular = Black ...but I can't find where to set Ambient or Emmissive. Am I on the right track? Does anyone know how to solve this please?
Your problem, I'm sure, is lying in each of the program's default material types. They're not the same, are they? What I mean is Lambert, Blinn, Phong, etc. What are each of the application applying?
laziness is the foundation of efficiency | www.AdrianWalker.info | Adventures in Game Production | @zer0wolf - Twitter
Advertisement
Hey thanks zer0wolf

I haven't learnt of Material Types before, but you've given a clue to hunt down.

:)

Update and SOLUTION!!!


Well I tried playing around with the material types like zer0wolf suggested.
However no matter what I did it seemed to make no difference to the exported DirectX (.x) model at all. The .x file seems to have very little in the way of Material data in fact. With my exports just the colours of Ambient, Diffuse, Specular etc...

So I started to suspect it could be something to do with the geometry of the model instead - perhaps the Normals.
So after much experimenting and pondering over Managed DirectX gamedev tutorial samples, I have finally found the solution.

One line of C# code fixed it. I simply had to set NormalizeNormals to true on the devices RenderState.

I haven't got my code in front of me right now (at work :( ), but I believe it was something like this...

_myDevice.RenderState.NormalizeNormals = true;



Problem solved. PHEW!!!

Thanks again.

This topic is closed to new replies.

Advertisement