Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, chsmac85, NeoDumont, dr_panther, TedMar), 1,095 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 3
Page 2 of 5 1 2 3 4 5
Re: Ultimate shader collection!!!! [Re: Daedelus] #43274
03/27/05 18:13
03/27/05 18:13
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Same problem here - In the meantime, if you want to test the demo without the bloom effect(and perhaps other effects as well...) just replace the "techex.wdl" code with this(same script only with the render parts commented out):

Code:
 var video_mode = 8;	 // screen size 640x480
var video_depth = 32; // 32 bit colour D3D mode

string level_str = <techex.WMB>; // give file names in angular brackets

dllfunction prototype;
dllfunction render_backbuffer(entity);

function main()
{
level_load(level_str);
freeze_mode = 1;
wait(4);
freeze_mode = 0;
//screengrab();
}

// Shader Part
var light_dist=700; //this is how far away form a light it will be visible.
action light_pos_object
{
wait(5);
my.invisible=on;
my.passable=on;


my.lightrange=700; //could be set also to a skill


my.red=128; //just put in the r,g,b values
my.green=128;
my.blue=128;

my.cast=on; //casts a shadow when on

}



//******************

bmap env_bmp=<env_map.bmp>;
bmap castle1_walls = <castle1_walls_t.tga>;
bmap castle1_walls_tDOT3 = <castle1_walls_tDOT3.tga>;
bmap castle1_walls_tH = <castle1_walls_tHeight.tga>;

material castle1_walls_t
{
skin2 = castle1_walls_tDOT3 ;
skin3 = castle1_walls_tH ;
flags = tangent;
}

material castle1_walls_2
{
skin1 = castle1_walls_tDOT3 ;
flags = tangent;
}

material castle1_walls_3
{
skin1 = castle1_walls_tDOT3 ;
flags = tangent;
}

material castle1_walls_4
{
skin1 = castle1_walls_tDOT3 ;
skin3 = castle1_walls;
skin4 = env_bmp ;
flags = tangent;
}
/*
/////////////////////////
// Bloom

material mat_bloom
{

}

entity glow_quad
{
type = <grey.TGA>; //128*128 works best but can be any size
//this entity is always invisible..
}

entity glow_quad_view
{
type = <grey.TGA>;
layer = 2; // display above view entities with layer 1
view = CAMERA; // same camera parameters as the default view
// set the x position according to the texture size..
// x = 36; // for 32
// x = 72; // for 64
x = 145; // for 128
y = 0; //center horzontally
z = 0; // and center vertically
}

function map_glow()
{
me=glow_quad_view;
my.ambient=10;
my.transparent=on;
my.bright=on;
my.alpha=50;
my.visible=on;
my.material=mat_bloom;
my.scale_x=1.33; //this scales it to screen proportions..
while(1)
{
//sets material skin1 to the rendered view tex
mat_bloom.skin1=bmap_for_entity(glow_quad,0);
wait(1);
}
}

function screengrab()
{
wait(20);
me=glow_quad;
map_glow();
while(1)
{
render_backbuffer(me);
wait(1);
}
}
*/
///////////////////
// Toon Shading

// Normaliser cubemap sprite
bmap bmp_normalizationcube=<tsnormalise.tga>;
// Paint shade map for toonshader
bmap bmp_tstonemap=<ts2tone.tga>; // <<< CHANGE THIS TO CHANGE PAINT SHADING

function mat_toon_init
{
bmap_to_cubemap(mtl.skin1);
}

material mat_toon
{
skin1=bmp_normalizationcube; // This is the normalisation cubemap created by the starter function
skin2=bmp_tstonemap;

flags=tangent;

event = mat_toon_init;
}

action Shader_Toon
{
//my.shadow = on;
//my.cast = on;
my.material = mat_toon;
render_shadows();
}

/*******************************************************
softshadows.wdl
(c)2005 Matt Aufderheide
*******************************************************/

string my_file;
string empty="";
string sourcefile;
entity* temp_ent;
var VecTo[3];
var VecFrom[3];

//change this for different LOD versions..
//here I am using the LOD 0 file ..
//however if you want, you can change it 1,2,3 to always have a
//low res model as your shadow..however it seems to work fine this way if you have LODs
//if you dont have LOD change this string to simply ".mdl"
string control_file="e.mdl";

//i have included this tga file
bmap softshadow_bmap = <shadow_color.tga>;

material mat_softshadows{}

//flatten the shadow to the ground normals
function shadow_to_normal()
{

temp_ent = YOU;

trace_mode = IGNORE_PASSENTS+ IGNORE_ME+ IGNORE_YOU+ IGNORE_MODELS;
vec_set(vecFrom,YOU.X);
vec_set(vecTo,vecFrom);
vecTo.Z -= 500;
result = trace(vecFrom,vecTo);

YOU = temp_ent; // YOU (the entity itself) is changed by SONAR

if(result > 0)
{
// place shadow 2 quants above the floor
MY.z = YOU.z - RESULT + 2; //YOUR.min_z*/ + 2 - RESULT;
MY.x = YOU.x;
MY.y = YOU.y;

// adapt shadow orientation to floor slope
if ((NORMAL.x != 0) || (NORMAL.y != 0))
{ // we're on a slope
// conform shadow to slope
MY.PAN = 0;
MY.tilt = - asin(NORMAL.x);
MY.roll = - asin(NORMAL.y);
temp.pan = YOU.PAN;
temp.tilt = 0;
temp.roll = 0;
rotate(my,temp,nullvector);
}
else
{
MY.pan = YOU.pan;
MY.tilt = 0; // set it flat onto the floor
MY.roll = 0;
}
}


}


//this function controls the far disnace you can see shadow
function shadow_vis()
{
while(me)
{
if (vec_dist(my.x,camera.x) > 1000) //adjust this dist here
{
my.invisible=on;
}

else

{
my.invisible=off;
}

wait(10+(random(5)));
}

}

//animate and move the shadow mesh
function shadow_mesh()
{
my.scale_x=your.scale_x;
my.scale_y=your.scale_y;
my.scale_z=your.scale_z;
my.scale_z*=0.01;

my.passable=on;
my.push=-1;

my.ambient=0;
my.transparent=on;
my.flare=on;
my.passable=on;
my.push=-1;

shadow_vis();

my.material=mat_softshadows;
mat_softshadows.skin1=softshadow_bmap;

my.skill41=float(0.4); // adjust this to increase blurriness..

while(me)
{

if you!=null
{
my.frame=your.frame;
my.next_frame=your.next_frame;
shadow_to_normal();
}

if you==null
{
ent_remove(me);
}

wait(1);
}

}

function render_shadows()
{
str_cpy(my_file,empty);
str_for_entfile (sourcefile, me);
str_trunc(sourcefile,5);
str_cpy(my_file,sourcefile);
str_cat(my_file,control_file);
ent_create(my_file,my.x,shadow_mesh);
}


///////////////////////
// Load Shaders

starter load_shaders()
{
d3d_automaterial=1;
effect_load(castle1_walls_t,"parallax.fx");
effect_load(castle1_walls_2,"normalmap_level_ps20.fx");
effect_load(castle1_walls_4,"spec_mapworld.fx");
effect_load(castle1_walls_3,"bumpmap.fx");
//effect_load(mat_bloom,"bloom.fx");
effect_load(mat_toon,"toon.fx");
effect_load(mat_softshadows,"softshadow.fx");
}



Thanks for the great demo Matt!


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Ultimate shader collection!!!! [Re: William] #43275
03/27/05 19:11
03/27/05 19:11
Joined: Dec 2003
Posts: 266
Celle
task1 Offline
Member
task1  Offline
Member

Joined: Dec 2003
Posts: 266
Celle
works great!


visit my pages: www.xiron.de ICQ: 335016379 Messenger: lalimited@hotmail.com
Re: Ultimate shader collection!!!! [Re: task1] #43276
03/27/05 22:15
03/27/05 22:15
Joined: Mar 2002
Posts: 7,726
old_bill Offline
Senior Expert
old_bill  Offline
Senior Expert

Joined: Mar 2002
Posts: 7,726
Very nice and usefull collection, thanks for sharing!

old_bill


Success is walking from failure to failure with no loss of enthusiasm.
Re: Ultimate shader collection!!!! [Re: old_bill] #43277
03/28/05 04:26
03/28/05 04:26
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Great contribution!

Just need to get that render_backbuffer not found corrected. It is still there even after you add the DLL file.

Loco


Professional A8.30
Spoils of War - East Coast Games
Re: Ultimate shader collection!!!! [Re: Locoweed] #43278
03/28/05 06:02
03/28/05 06:02
Joined: Nov 2004
Posts: 832
United States, Utah
Braxton Offline
Developer
Braxton  Offline
Developer

Joined: Nov 2004
Posts: 832
United States, Utah
I can't get the mat_toon to work in my game. How can I fix this?


"The GREAT LAW: Life is and always will be justly ordered, and that all past experiences, good and bad, were the equitable out working of our evolving, yet unevolved selves" - As A Man Thinketh
Re: Ultimate shader collection!!!! [Re: Braxton] #43279
03/28/05 09:34
03/28/05 09:34
Joined: Jul 2003
Posts: 893
Melbourne, Australia
Matt_Coles Offline OP

User
Matt_Coles  Offline OP

User

Joined: Jul 2003
Posts: 893
Melbourne, Australia
solved the renderview dll problem, you can't have the dll in the game folder as it comes up with this error, you have to place it in the main gamestudio folder under acknex_plugins for the engine to read the dll.

Braxton: What exactly is happening with your toon shading? Do you get anything error messages on screen or is the shader just not showing?

Matt Coles

Re: Ultimate shader collection!!!! [Re: Matt_Coles] #43280
03/28/05 10:31
03/28/05 10:31
Joined: Aug 2003
Posts: 448
Pluto
SlyBoots Offline
Senior Member
SlyBoots  Offline
Senior Member

Joined: Aug 2003
Posts: 448
Pluto
That helped, thanks again.


3DSK Human Photo References for 3D Artists and Game Developers
Re: Ultimate shader collection!!!! [Re: Matt_Coles] #43281
03/28/05 11:20
03/28/05 11:20
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Quote:

Braxton: What exactly is happening with your toon shading? Do you get anything error messages on screen or is the shader just not showing?




His card probably doesn't support it, takes some of us a while to realize that

-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Ultimate shader collection!!!! [Re: Rhuarc] #43282
03/28/05 12:19
03/28/05 12:19
Joined: Jul 2003
Posts: 893
Melbourne, Australia
Matt_Coles Offline OP

User
Matt_Coles  Offline OP

User

Joined: Jul 2003
Posts: 893
Melbourne, Australia
I would have thought it to have worked though, if the all the other shaders worked.

Re: Ultimate shader collection!!!! [Re: Matt_Coles] #43283
03/28/05 14:24
03/28/05 14:24
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Ah, yes, we should have known, it's the dll must be read by the engine from the acknex_plugins folder error.

Thanks, this is a very nice colection all put into one nice neat script.

Loco


Professional A8.30
Spoils of War - East Coast Games
Page 2 of 5 1 2 3 4 5

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1