Welcome! Log In Create A New Profile

Advanced

how to use bump mapping on wii?

Posted by copete23 
how to use bump mapping on wii?
October 21, 2009 02:09AM
Hello, I would use bump mapping on wii, but do not know how the technique works in GX, Can anyone explain how to use bump mapping on wii, some example or something?

thanks:)
Re: how to use bump mapping on wii?
October 21, 2009 08:53AM
It's kinda complicated. You have to give nprmal coordinates in tangent bitangent space, give a diferential map to the system, etc... but the big problem is that normal mapping requires hardware lighting, and as far as I know hardware lighting doesn't work anymore.
Re: how to use bump mapping on wii?
October 21, 2009 02:55PM
hardware lighting doesn't work? do you mean, LIGHT0 , LIGHT1 ...?, sorry, but my English is a bit bad : ( Do you mean it does not work only with bump-mapping?, because I am using hardware lighting and work ok (i think).

It is unfortunate that there is no example on how to implement bump-mapping on wii, if someone could give me some example on how to do, I appreciate it very much :)
Re: how to use bump mapping on wii?
October 21, 2009 05:41PM
Yes, I mean LIGHT0, LIGHT1, etc...
so you're using hardware lighting and it works properly in the current version of LibOgc???
oh please, could you show me an example of that??? because I'm very frustrated trying to make lights work but all I get is bad lighting.
When I use lights all i get is full lighted vertices and non-lighted vertices, there is no intermediate result, and I thought it was some weird bug.

I've never tried to use bump-mapping on the wii because I couldn't make the lights work, but if lighting does work then it's theoretically not that dificult tu use bump-mapping. I could help you if I could make some testing.
Re: how to use bump mapping on wii?
October 21, 2009 08:01PM
I get a more or less decent lighting using just one light (LIGHT0) using version 1.7.1 of libogc.

This is the code:


void luz1(Mtx view, f32 x, f32 y, f32 z){

GXColor color[]={
{255, 255, 255, 255}, // light color
{80, 80, 80, 255}, // ambient color
{255, 255, 255, 255} //difuse color
};

GXLightObj obj_luz;     
Vector posicion; // vec of position
Vector luz_dir;    // direcction of the lght (not work very well)


luz_dir.x=-1.0F; 
luz_dir.y=-0.5F; 
luz_dir.z=1.0F;     

posicion.x=x;
posicion.y=y;
posicion.z=z;

/// This update the normal position as the position of the polygon
guVecMultiply(view,&posicion,&posicion);
guVecMultiply(view,&posicion,&luz_dir);
guVecSub(&posicion, &posicion, &luz_dir);
guVecNormalize(&luz_dir);     

        GX_InitLightPos(&obj_luz,posicion.x,posicion.y,posicion.z);
	GX_InitLightColor(&obj_luz,color[0]);
	GX_InitLightDir(&obj_luz,-1.0F,-0.5F,1.0F);
	GX_InitLightSpot(&obj_luz,91.0F,GX_SP_RING1);/// (not working)
	GX_InitLightDistAttn(&obj_luz,-1.0F,1.0F,GX_DA_GENTLE); (not work very well)

	GX_LoadLightObj(&obj_luz,GX_LIGHT0); // hardware lighting
	//Channel Control - have to turn the lighting on.
	GX_SetChanCtrl(GX_COLOR0,GX_ENABLE,GX_SRC_REG,GX_SRC_REG,GX_LIGHT0,GX_DF_CLAMP,GX_AF_SPOT);
	GX_SetChanAmbColor(GX_COLOR0A0,color[1]);
	GX_SetChanMatColor(GX_COLOR0A0,color[2]);
}

that's all, not whether it works as it should work, is complicated the illumination in wii, but this is the result:

image 1
image 2

Not very good lighting, but it looks good.
Re: how to use bump mapping on wii?
October 24, 2009 05:29PM
Quote
copete23
Can anyone explain how to use bump mapping on wii, some example or something?

The following is the method I've tried and the one shown in figure 12 of the gamasutra article:

You supply 3 normals (NBT) for each vertex and two textures - a ds/dt difference map and a light probe representing the diffuse lighting. You setup 3 TEV stages, where the first two look up the ds and dt from your difference map, and the 3rd adds those offsets to the normal. The offset normal is then used to look up a diffuse value from your light probe.

You can find more technical details in the Nintendo patents. Here's one, but be sure to look at all the GX related patents (search google patents for Nintendo GX).

EDIT: Another related patent - contains detail on the GX_SetTevIndBumpST() function



Edited 1 time(s). Last edit at 10/26/2009 12:35AM by Michael.
Re: how to use bump mapping on wii?
October 25, 2009 03:16PM
Thank you very much Michael, i'll have a look, but ugh, seems complicated XD.
After Bump Mapping - Environment mapping and reflection
May 25, 2010 12:20AM
I just would like to recall an interresting link to a 3D demonstration of light effects with GX.
It is not really oriented on bump mapping but it uses environment mapping and shadow reflection which are some other advanced GX functions.

You will find on this page a PDF documentation on "GX - 3D Graphicos para Wii" and some associated examples by Hermes with sources and precompiled dol files. It allows to understand how to configure Normals, Lights and TEV Stages to obtain these effects.

Forum - elotrolado.net
or
Forum - entuwii.net

Image of the scene ( Forum - elotrolado.net )




Edited 1 time(s). Last edit at 05/25/2010 12:22AM by michela.
Sorry, only registered users may post in this forum.

Click here to login