xXxGuitar's Normal Mapping Shader for Lite-C

Posted By: D3D

xXxGuitar's Normal Mapping Shader for Lite-C - 07/18/07 22:34

Few days back converted the Normal Mapping Shader from xXxGuitar in the User Contribution forum to Lite-C.
Download the demo.

Doom3 model exported by Kai Kieschnick. The model can't be used for any commercial project and was only taken to show the effect.

Code:
//--------------------------------------------------------------
// Normal Mapping Shader
//
// Matt_Aufderheide, Bloodline, William, xXxGuitar511
// -------------------------------------------------------------
// title: Normal Mapping Shader
// text: -
// -------------------------------------------------------------

#include <acknex.h>
#include <default.c>

// entry: FX File:
STRING* fxNM = "NM.fx";
STRING* MyAppTitle = "Normal Mapping Shader";

// section: Ambient Lighting:
// enable: Faked Dynamics
#define staFake
// enable: Ambience
#define staAmb

MATERIAL* comics =
{
ambient_blue = 100;
ambient_green = 100;
ambient_red = 100;
albedo = 0;
}

MATERIAL* mat_NM =
{
// section: Diffuse:
// entry: Red
diffuse_red = 255;
// entry: Green
diffuse_green = 255;
// entry: Blue
diffuse_blue = 255;

// section: Ambient:
// entry: Red
ambient_red = 16.0;
// entry: Green
ambient_green = 16.0;
// entry: Blue
ambient_blue = 16.0;

// // section: Sun:
// // entry: Red
// specular_red = 64.0;
// // entry: Green
// specular_green = 64.0;
// // entry: Blue
// specular_blue = 64.0;

// section: Static Lighting:
// entry: Red
emissive_red = 255.0;
// entry: Green
emissive_green = 255.0;
// entry: Blue
emissive_blue = 255.0;
//
flags = tangent | enable_render;
effect = fxNM;
//event = checkLight;
}


function effect_startup()
{
effect_load(mat_NM, fxNM);
//
var SLF;
while(1)
{
SLF = 0;
#ifdef staAmb
SLF += 1;
#endif
#ifdef staFake
SLF += 2;
#endif
//
vec_set(mat_NM.specular_blue, sun_color);
mat_NM.skill1 = pixel_for_vec(nullvector, SLF*10, 8888);
wait(1);
}
}

//function checkLight()
//{
// vec_set(temp, my.x);
// temp.z -= floor_range;
// c_trace(my.x, temp, ignore_me | scan_texture);
// mtl.skill1 = pixel_for_vec(tex_color, tex_light, 8888);
//}

#define _Red skill1
#define _Green skill2
#define _Blue skill3
#define _Range skill4
// action: Dynamic Light
// text: -
// skill1: Red 128
// skill2: Green 128
// skill3: Blue 128
// skill4: Range 300
action DLight()
{
my.red = my._Red;
my.green = my._Green;
my.blue = my._Blue;
my.lightrange = my._Range;
set(my,LIGHT);
}

void init_normal()
{
effect_startup();
}


action SpinMe()
{
while(1)
{
my.material = mat_NM;
my.pan -= 2 * time_smooth;
wait(1);
}
}

void main()
{
fps_max = 60;
video_mode = 6;
video_window(vector(375,350,0),NULL,112,MyAppTitle);
screen_color.blue = 125;
level_load("normal.wmb");
wait(2);
init_normal();
}


Posted By: maglat

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 07/19/07 05:14

I LOOOOVE this normal mapping shader. It looks so great. Thx for this great work
Posted By: frazzle

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 07/19/07 06:55

Thanks for the effort D3D, I appriciate your work !!

Cheers

Frazzle
Posted By: xXxGuitar511

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 07/21/07 03:03

yes, thanks again D3D. One day I'll jump into lite-c as I did with HLSL, though I'm sure lite-c will be much easier
Posted By: Sam_Be

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 09/14/07 16:52

hi
which of the scripts do i have to include into my mainscript?? and where can i change the textures and normalmaps??
thx
sam
Posted By: 3Dski

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 11/02/07 18:35

Wasn't able to access any of the realated URLs, so can not get NM.fx to even takeing the long way to viewing its usage. Can someone help?

EDITED: Actually, I was able to search on NM.fx under the Shaders category and able to find NM.fx there, as well as additional info : )
Posted By: D3D

Re: xXxGuitar's Normal Mapping Shader for Lite-C - 11/02/07 18:46

The file is available on another host, try here.
© 2024 lite-C Forums