Brightness of EMT_NORMAL_MAP_SOLID

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Brightness of EMT_NORMAL_MAP_SOLID

Post by gfxstyler »

Hi!

I'm using the OpenGL driver and nodes with the EMT_NORMAL_MAP_SOLID material are way too dark in my opinion.

Do they ignore the global ambient value (setAmbientLight)? Because the parts of the mesh that do not face the light directly are pitch black.

I'd like to change that behaviour but im not experienced with shaders (especially not low-level ones).

Can some shader-guy tell me what i have to change in COpenGLNormalMapRenderer.h to make the node brighter/take ambient light into account?

thanks in advance!
datamagik
Posts: 26
Joined: Wed Feb 14, 2007 11:25 pm
Location: Bar Harbor, Maine USA

Post by datamagik »

I think the place you'd have to change would be in the meat of COpenGLNormalMapRenderer.cpp

I see a lot of hand coded D3D asm code that has been directly translated to its OpenGL equivalent. I'm going to have to get a lot deeper into the OpenGL docs before I'd venture a guess (and this from a guy who's always loved assembly language coding and thinks it would be a hoot to write an OS).

You may find it easier to adjust the colors in the objects you are illuminating. Look at your work on an LCD display before you do. This is probably the correct brightness. I've found that most PC monitors display a bit dark compared to the high end variety found in high end PCs and Macs. When designing a graphic for web I tend to make it a bit brighter to compensate for viewing on older monitors.

I would like to study the OpenGL interface in Irrlicht because I notice it doesn't seem to render textures properly on OpenGL versions prior to 1.3 (for example my eMachines w3080 based on AMD Athlon XP+ and S3 Unichrome K400 chipset). But this is low on my list of priorities at the moment (making the build process for Mac OS more of a generic Irrlicht build, and isolating OS dependent parts from the core rendering engine has precedence for me).

If you feel like rolling up your sleeves and tackling the OpenGL classes in Irrlicht, perhaps you could include a method for determining the version of OpenGL in use and let the code adapt it's interface accordingly (my hunch is having a 1.2, 1.5, and a 2.0 version would allow the engine the broadest compatibility with older hardware while taking advantage of newer features where available. If you do accept this noble quest please consider contributing your improvements to the project! :)
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

The diffuse colour isnt passed at all, just the light diffuse (which is just the light colour)

Want to add the diffuse just look for the line

Code: Select all

"PARAM height_scale = program.local[0]; \n"\
press enter at the end of that line, then paste

Code: Select all

"PARAM gdiffuse= program.local[1]; \n"\
go to

Code: Select all

"MUL outColor, temp, colorMapColor; \n"\
replace with

Code: Select all

"MAD outColor, temp, colorMapColor,gdiffuse; \n"\
and inside this

Code: Select all

void COpenGLNormalMapRenderer::OnSetConstants(IMaterialRendererServices* services, s32 userData)
add this

Code: Select all

f32 diff[] = {diffusered,diffusegreen,diffuseblue,diffusealpha};
	services->setPixelShaderConstant(diff, 1, 4);
after this

Code: Select all


	f32 c6[] = {factor, factor, factor, factor};
	services->setPixelShaderConstant(c6, 0, 1);
you figure out how to get the diffuse value to that class, im too lazy to look up the api. :oops:
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Post by gfxstyler »

this does not work omar :shock:

anyway, i decided to kick bumpmapping support out of my project anyway, so i don't need it anymore.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

what error does it give you?
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
Post Reply