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
3 registered members (dr_panther, VoroneTZ, AndrewAMD), 834 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 7 of 11 1 2 5 6 7 8 9 10 11
Re: Water Shader: Exchange the cube_map [Re: Leon] #35873
01/05/05 05:22
01/05/05 05:22
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline OP
Serious User
Steempipe  Offline OP
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Quote:

the exe works fine..
when i use the code in my work folder i got a problem

"parameter unknown d3d_shaderversion"

i'm using 6.30 commercial

ps: the watershader.fx is already included!

??????????????????




Update to 6.31+, or remove the IF block in the function load_water_fx in water.wdl and simply have:

effect_load(water_fx,"watershader.fx");
wait(5);

Re: Water Shader: Exchange the cube_map [Re: old_bill] #35874
01/05/05 06:35
01/05/05 06:35
Joined: Oct 2002
Posts: 815
NY USA
R
Red Ocktober Offline
Developer
Red Ocktober  Offline
Developer
R

Joined: Oct 2002
Posts: 815
NY USA
old bill... i copied the watershader code from the demo (water.wdl) and didn't get any of the problems above...


also...

did you get the watershader working inside an enclosed room yet, without the skycube?

--Mike

Re: Water Shader: Exchange the cube_map [Re: Red Ocktober] #35875
01/05/05 06:47
01/05/05 06:47
Joined: Mar 2002
Posts: 7,726
old_bill Offline
Senior Expert
old_bill  Offline
Senior Expert

Joined: Mar 2002
Posts: 7,726
Yes, now the code from ventilator works.
I used it to create a CubeMap from the position of my water (inside a room) and replaced the
sky cube map with the one from the script, and now i have a "real" environment reflection!

old_bill


Success is walking from failure to failure with no loss of enthusiasm.
Re: Water Shader: Exchange the cube_map [Re: old_bill] #35876
01/05/05 06:58
01/05/05 06:58
Joined: Oct 2002
Posts: 815
NY USA
R
Red Ocktober Offline
Developer
Red Ocktober  Offline
Developer
R

Joined: Oct 2002
Posts: 815
NY USA
great...

hey, i was also playing with it a lil...

the code went in so easily that even i could mod it for custom use... i wound up shading a matrix (.hmp) and applying some undulating water code... and amazingly it worked

click here to see (modem user right click and save target as 662KB)---> Moving Water Using Steem's Shader

verrrrry verrrrry nice resource Steem... THANKS

--Mike

Re: Water Shader: Exchange the cube_map [Re: Red Ocktober] #35877
01/05/05 07:07
01/05/05 07:07
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline OP
Serious User
Steempipe  Offline OP
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Looks good! And; you're welcome.

Glad that the effect is getting tinkered with and expanded upon. There is soooooo much that needs to be done to that code. My wishlist is.... well, just a wishlist at the moment.

Re: Water Shader: Exchange the cube_map [Re: Red Ocktober] #35878
01/05/05 07:13
01/05/05 07:13
Joined: Mar 2002
Posts: 7,726
old_bill Offline
Senior Expert
old_bill  Offline
Senior Expert

Joined: Mar 2002
Posts: 7,726
Very nice example of moving water!

I'm currently working on a code which allows to have multiple watersurfaces with a environment cubemap
without having trouble with the cubemap handling...
Will post if succed!

old_bill


Success is walking from failure to failure with no loss of enthusiasm.
Re: Water Shader: Exchange the cube_map [Re: old_bill] #35879
01/05/05 16:01
01/05/05 16:01
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
That looks great red! Would you be willing to share the code?


Check out Silas. www.kartsilas.com

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

Daily dev updates - http://kartsilas.blogspot.com/
Re: Water Shader: Exchange the cube_map [Re: Red Ocktober] #35880
01/05/05 22:00
01/05/05 22:00
Joined: Nov 2004
Posts: 23
R
Robin Offline
Newbie
Robin  Offline
Newbie
R

Joined: Nov 2004
Posts: 23
nice m8.
Can you post the code about reflecting hmp?

Re: Water Shader: Exchange the cube_map [Re: William] #35881
01/05/05 23:22
01/05/05 23:22
Joined: Oct 2002
Posts: 815
NY USA
R
Red Ocktober Offline
Developer
Red Ocktober  Offline
Developer
R

Joined: Oct 2002
Posts: 815
NY USA
... sure guys, after all... i'd be nowhere whithout the generous code sharing of so many others here who are really making the advanced capabilities of the engine accessible.

the code is based on the 'Realistic Water' article from the AUM compilation (AUM 34)...

ok... here it is... for better or worse (sorry for the mixed styles and messy commenting)

basically, all i did was merge the moving water code and Steempipe's water shader code and watershader.fx

you are going to need to make a simple terrain as outlined in the AUM34 Realistic Water article... and you should have Steempipe's demo for the shader file and environment bitmaps... the code simply assigns the material to whatever entity calls the WaterShader action, so assing this action to your water terrain.

also, i am using the version 6 templates, so if you are using the older templates, just pick and choose what you need.



Code:
 



path "C:\\Program Files\\GStudio\\template_6"; // Path to A6 templates directory
path "C:\\Program Files\\GStudio\\template_6\\code"; // Path to A6 template code subdirectory
path "C:\\Program Files\\GStudio\\template_6\\images"; // Path to A6 template image subdirectory
path "C:\\Program Files\\GStudio\\template_6\\sounds"; // Path to A6 template sound subdirectory
path "C:\\Program Files\\GStudio\\template_6\\models"; // Path to A6 template model subdirectory
path "C:\\program files\\gstudio\\work\\text_src";
path "C:\\program files\\gstudio\\work";
path "C:\\program files\\virtuqal sailor\boats\ohio";


include <gid01.wdl>; // global ids
include <display00.wdl>; // basic display settings
include <plSelect.wdl>;
include <cameraTarget.wdl>;
include <miscInput01.wdl>;
include <plBipedInput01.wdl>;
include <bipedPhy01.wdl>;
include <bipedAnim01.wdl>;
include <bipedSnd01.wdl>;
include <plBiped01.wdl>;
include <cameraSelect.wdl>;
include <camera1stPerson01.wdl>;
include <shader_light.wdl>;



bind <watershader.fx>;


string level_str=<movingwatershader.wmb>; // **** THIS IS THE NAME OF THE LEVEL


var video_mode=7;
var video_depth=32;
var video_screen=1;


var index;
var counter;
define amplitude skill1;
define water_speed skill25;
define number_of_vertices 1089;
var vertex_array [1089];

var d3d_automaterial=1;




function init_detail_mapping(){
bmap_to_mipmap(mtl.skin1);
d3d_automaterial=1;
}


sky skycube {
type = <montskya+6.tga>;
flags = cube,visible,overlay;
layer = 1;
}



bmap water_cube=<montskysma+6.tga>;
bmap water_bump=<waterbump5.tga>;


function mtl_water_init()
{

bmap_to_cubemap(bmap_to_mipmap(mtl.skin2));
bmap_to_mipmap(mtl.Skin1);

}

/////////////////////////////////////////////////////////////////////////////////
// The material definition used in the watershader
//
material wave1 {

skin1=water_bump;
skin2=water_cube;

flags=tangent;

event = mtl_water_init;

}



var ShaderCount;

//////////////////////////////////////////////////////////////////////////////////
// The action to assign to the water terrain, basically it is the wave code with
// the material used in the shader assigned to the water terrain
//
Action WaterShader
{
my.material = wave1; /// **** THIS MAKES THE TERRAIN USE STEEMPIPE'S
/// WATER SHADER CODE, THAT'S ALL THERE WAS TO IT

my.scale_x=40; /// **** RESIZE THE WATER TERRRAIN MATRIX IF YOU DESIRE
my.scale_y=40;

my.transparent=on; /// **** SEE THRU IT OR NOT WHATEVER
my.nofog = on; /// **** FOG SEEMS TO WORK WITH THIS SHADER IF U WANT IT... COOL


// **** SETTING UP FOR THE WAVES

if (my.amplitude == 0)
{
my.amplitude = 2.84; // default wave amplitude value
}
if (my.water_speed == 0)
{
my.water_speed =7.4; // default wave speed value
}
while (counter < number_of_vertices)
{
vertex_array[counter] = random(360); // set random values in vertex_array
counter += 1;
}


while(1) // **** MAKE WAVES ALL THE TIME
{
my.skill41=float(ShaderCount);
my.skill42=float(0);
my.skill43=float(0);
my.skill44=float(0);

ShaderCount += 0.00287; // ******* AFFECT SPEED OF WAVE MOVEMENT HERE



index = 0;

my.u += .25*time;
my.v += .25*time;
wait (1);



while (index < number_of_vertices)
{
vec_for_mesh(temp, my, index); // store the vertex coordinates in temp
temp.z = sin(counter + vertex_array[index]) * my.amplitude; // change the z component
vec_to_mesh(temp, my, index); // deform the terrain entity
index += 1;
}
counter += my.water_speed * time;
//wait(1);



wait(1);}


}


//////////////////////////////////////////////////////////////////////////////////////
// **** Load the effect file if pixelshader version
// is better then 1.1.
// If not, then exit the Engine.

function load_water_fx() {

if (d3d_shaderversion >= 1111)
{
effect_load(wave1,"watershader.fx");
wait(5);
return;
}
else
{
wait(5);
exit;
}

}


/////////////////////////////////////////////////////////////////
// Desc: The main() function is started at game start
function main()
{
// set some common flags and variables
// freeze all entity functions
freeze_mode = 1;
// no level has been loaded yet...
gid01_level_state = gid01_level_not_loaded;

// entry: Warning Level (0,1, or 2)
// entry_help: Sets sensitivity to warnings (0 = none, 1 = some, 2 = all).
warn_level = 2; // announce bad texture sizes and bad wdl code


// entry: Starting Mouse Mode (0, 1, or 2)
mouse_mode = 0;

// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

// now load the level
level_load(level_str); // **** LOADS THE LEVEL YOU SET ABOVE


wait(2); // let level load
// level should be loaded at this point...
gid01_level_state = gid01_level_loaded;

load_water_fx(); // **** CALLS THE FUNCTION THAT LOADS THE WATER SHADER


wait(5);




//
// **** MAIN GAME LOOP
while(1)
{
if(gid01_level_state != gid01_level_loaded)
{
// pause the game
freeze_mode = 1;
}
else
{
// un-freeze the game
freeze_mode = 0;
}
wait(1);
}
}


// Desc: this is the function used to restart the game.
function main_restart_game()
{
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

// now load the level
level_load(level_str);
// freeze the game
freeze_mode = 1;

load_water_fx();
// fog_color = 1; // use the first fog color
// d3d_fogcolor1.red = 133; // your values here
// d3d_fogcolor1.green =175; // your values here
// d3d_fogcolor1.blue = 255; // your values here
// camera.fog_start = 100; // your values here
// camera.fog_end = 1500; // your values here

wait(2); // 1-level loads, 2-entities load

//+++ load starting values

// un-freeze the game
freeze_mode = 0;
}


// Desc: this is the function used to quit the game.
function main_quit()
{
//+++ // save global skills & strings
exit;
}

/////////////////////////////////////////////////////////////////
// The following definitions are for the pro edition window composer
// to define the start and exit window of the application.
WINDOW WINSTART
{
TITLE "3D GameStudio";
SIZE 480,320;
MODE IMAGE; //STANDARD;
BG_COLOR RGB(240,240,240);
FRAME FTYP1,0,0,480,320;
// BUTTON BUTTON_START,SYS_DEFAULT,"Start",400,288,72,24;
BUTTON BUTTON_QUIT,SYS_DEFAULT,"Abort",400,288,72,24;
TEXT_STDOUT "Arial",RGB(0,0,0),10,10,460,280;
}

/* no exit window at all..
WINDOW WINEND
{
TITLE "Finished";
SIZE 540,320;
MODE STANDARD;
BG_COLOR RGB(0,0,0);
TEXT_STDOUT "",RGB(255,40,40),10,20,520,270;

SET FONT "",RGB(0,255,255);
TEXT "Any key to exit",10,270;
}*/


/////////////////////////////////////////////////////////////////
//INCLUDE <debug.wdl>;








--Mike

Re: Water Shader: Exchange the cube_map [Re: Red Ocktober] #35882
01/06/05 03:42
01/06/05 03:42
Joined: Nov 2004
Posts: 23
R
Robin Offline
Newbie
Robin  Offline
Newbie
R

Joined: Nov 2004
Posts: 23
Thanks a lot!

Page 7 of 11 1 2 5 6 7 8 9 10 11

Moderated by  Blink, Hummel, Superku 

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