Gamestudio Links
Zorro Links
Newest Posts
Why Zorro supports up to 72 cores?
by 11honza11. 04/26/24 08:55
M1 Oversampling
by 11honza11. 04/26/24 08:32
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, VoroneTZ, Quad, 1 invisible), 823 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 8 of 11 1 2 6 7 8 9 10 11
Re: Water Shader: Exchange the cube_map [Re: Robin] #35883
01/06/05 15:42
01/06/05 15:42
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Thanks!


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: William] #35884
01/14/05 16:29
01/14/05 16:29
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Hey... Steempipe did you ever convert the pixel shader to HLSL? i have tried but i dont really get the theory here.. I know you have to use a higher PS version, at probably 1.4 or 2.0 becuase 1.1 doesnt support dependent reads..

. [Re: Steempipe] #35885
01/17/05 03:58
01/17/05 03:58
Joined: Jun 2004
Posts: 241
muralist Offline
Member
muralist  Offline
Member

Joined: Jun 2004
Posts: 241
.

HLSL Water Code and Day-Night transitions [Re: muralist] #35886
01/19/05 08:04
01/19/05 08:04
Joined: Jun 2004
Posts: 241
muralist Offline
Member
muralist  Offline
Member

Joined: Jun 2004
Posts: 241
The water looks terrific. Is there any way to change the water's cubemap so it changes along with this day night script? I have a level with nice dawn, noon, dusk, and midnight cubemaps, with the following script. I would like to tie it to the water so the whole environment changes over time.



var ticks_u_minuti = .16; // 1 min ingame time = 1 sec = 16 ticks

var minuta = 0; // starting game minutes

var sat = 17; // starting game hour

var dan = 1; // starting game day

var mjesec = 1; // starting game month

var godina = 1000; // starting game year

var dan_u_tjednu = 1; // starting day of the week

var brojac = 0;

var vrijeme1 = 0;



font standard_font = <ackfont.pcx>, 6, 9; // uncomment this if you're not using the templates



// months in a year

string 1_mjesec = "January";

string 2_mjesec = "February";

string 3_mjesec = "March";

string 4_mjesec = "April";

string 5_mjesec = "May";

string 6_mjesec = "June";

string 7_mjesec = "July";

string 8_mjesec = "August";

string 9_mjesec = "September";

string 10_mjesec = "October";

string 11_mjesec = "November";

string 12_mjesec = "December";



// days in a week

string 1_dan = "Monday";

string 2_dan = "Tuesday";

string 3_dan = "Wednesday";

string 4_dan = "Thursday";

string 5_dan = "Friday";

string 6_dan = "Saturday";

string 7_dan = "Sunday";



// temp strings

string temp_sat_str[8];

string temp_min_str[2];

string temp_dan_str;

string temp_mjesec_str;

string temp_godina_str;

string temp_day_nmb;

string day_title[2];





// string array for months

text MjesecUGodini

{

strings = 12;

string = 1_mjesec, 2_mjesec, 3_mjesec, 4_mjesec, 5_mjesec, 6_mjesec, 7_mjesec, 8_mjesec, 9_mjesec, 10_mjesec, 11_mjesec, 12_mjesec;

}



//string array for days

text DanUTjednu

{

strings = 7;

string = 1_dan,2_dan,3_dan,4_dan,5_dan,6_dan,7_dan;

}



// display date text object

text PrikaziDatum

{

pos_x = 20;

pos_y = 40;

font = standard_font;

strings = 1;

string = temp_dan_str;

}



// display clock text object

text PrikaziSat

{

pos_x = 20;

pos_y = 80;

font = standard_font;

strings = 1;

string = temp_sat_str;

}



// put this function in Main() if you want the Time Manager only

function init_time()

{

pass_time();

get_datetime();

PrikaziSat.visible = on;

PrikaziDatum.visible = on;

}



// this is time calculation function

function pass_time()

{

while(1)

{

// wait for the given number of ticks (16 ticks = 1 second)

waitt(ticks_u_minuti);

// then increase minute counter by 1

minuta += 1;

IF (minuta > 59)

{ // if one hour has passed

minuta = 0;

sat += 1;

}

if (sat > 23)

{ // ome day has passed

sat = 0;

dan += 1;

dan_u_tjednu += 1;

}

if (dan_u_tjednu > 7)

{ // we check the day of the week, if the number is bigger than 7 then it's Monday again

dan_u_tjednu = 1;

}

// we check what month it is

if ((mjesec == 1) || (mjesec == 3) || (mjesec == 5) || (mjesec == 7) || (mjesec == 8) || (mjesec == 10) || (mjesec == 12))

{

brojac = 31;

}

if ((mjesec == 4) || (mjesec == 6) || (mjesec == 9) || (mjesec == 11))

{

brojac = 30;

}

// if it's February

if (mjesec == 2)

{

brojac = 28;

}

if (dan > brojac)

{ // one month has passed

dan = 1;

mjesec += 1;

}

if (mjesec > 12)

{ // one year has passed

godina += 1;

mjesec = 1;

}

// date check

if (dan == 1)

{

str_cpy(day_title, "st");

}

if (dan == 2)

{

str_cpy(day_title, "nd");

}

if (dan == 3)

{

str_cpy(day_title, "rd");

}

if (dan >= 4)

{

str_cpy(day_title, "th");

}

}

}



// this function creates the apropriate panels for time/date panels

function get_datetime()

{

while(1)

{

// date panel

str_cpy(temp_dan_str, DanUTjednu.string[dan - 1]);

str_cpy(temp_mjesec_str, MjesecUGodini.string[mjesec - 1]);

str_for_num(temp_godina_str,godina);

str_for_num(temp_day_nmb,dan);

str_cat(temp_dan_str, " ");

str_cat(temp_dan_str, temp_day_nmb);

str_cat(temp_dan_str, day_title);

str_cat(temp_dan_str, ", ");

str_cat(temp_dan_str, temp_mjesec_str);

str_cat(temp_dan_str, ", ");

str_cat(temp_dan_str, temp_godina_str);

str_cat(temp_dan_str, " NR");

// clock panel

str_for_num(temp_sat_str, sat);

str_cat(temp_sat_str, " : ");

str_for_num(temp_min_str,minuta);

str_cat(temp_sat_str, temp_min_str);

wait(1);

}

}



//////////////////////////////////////////////////////////////////////////////////////////

// Day/Night change


sky jutro // this is the noon skycube
{
type = <Sky_MexicaNoon+6.tga>;
flags = cube,visible;
layer = 1;
flags = cube, visible, transparent;
alpha = 100;
layer = 2;
}

sky sumrak // this is the sunset skycube
{
type = <Sky_MexicaSunset+6.tga>;
flags = cube,visible;
layer = 1;
flags = cube, visible, transparent;
alpha = 100;
layer = 2;
}

sky noc // night skycube
{
type = <Sky_MexicaMidnight+6.tga>;
flags = cube,visible;
layer = 1;
flags = cube, visible, transparent;
alpha = 100;
layer = 2;
}

sky podne // morning skycube
{
type = <Sky_MexicaDawn+6.tga>;
flags = cube,visible;
layer = 1;
flags = cube, visible, transparent;
alpha = 100;
layer = 2;
}

// state vars

var dan_ili_noc = 1; // 0 - Night, 1 - Noon, 3 - Sunset, 4 - Morning, 0.5 - transition



// noon to sunset transition function

function podne_u_sumrak(duration)

{

var trans;

if(dan_ili_noc != 1) { return(-1); }

sumrak.visible = on;

if(duration > 0)

{

dan_ili_noc = 0.5;

trans = duration;

while(trans > 0)

{

jutro.alpha = 100*(trans/duration);

trans -= time;

wait(1);

}

dan_ili_noc = 3;

}

jutro.alpha = 0;

jutro.visible = off;

}



// sunset to night transition function

function sumrak_u_noc(duration)

{

var trans;

if(dan_ili_noc != 3) { return(-1); }

noc.visible = on;

if(duration > 0)

{

dan_ili_noc = 0.5;

trans = duration;

while(trans > 0)

{

sumrak.alpha = 100*(trans/duration);

trans -= time;

wait(1);

}

dan_ili_noc = 0;

}

sumrak.alpha = 0;

sumrak.visible = off;

}



//night to morning transition function

function noc_u_zoru(duration)

{

var trans;

if(dan_ili_noc != 0) { return(-1); }

podne.visible = on;

if(duration > 0)

{

dan_ili_noc = 0.5;

trans = duration;

while(trans > 0)

{

noc.alpha = 100*(trans/duration);

trans -= time;

wait(1);

}

dan_ili_noc = 4;

}

noc.alpha = 0;

noc.visible = off;

}



// morning to noon transition function

function zora_u_podne(duration)

{

var trans;

if(dan_ili_noc != 4) { return(-1); }

jutro.visible = on; //

if(duration > 0)

{

dan_ili_noc = 0.5; // transition flag

trans = 0;

while(trans < duration)

{

jutro.alpha = 100 * (trans/duration);

trans += time;

wait(1);

}

dan_ili_noc = 1; //

}

jutro.alpha = 100;

podne.visible = off;

}



// state changing function, put this into the Main() function if you want the Day/Night Manager only

function change_sky()

{

while(1)

{

if (sat == 5) // if it's 6 AM then change the sky from night to morning

{

noc_u_zoru(128 * ticks_u_minuti); // change the number 16 to a higher number if you want a longer transition

}

if (sat == 11) // if it's 12 PM then change the sky from morning to noon

{

zora_u_podne(128 * ticks_u_minuti);

}

if (sat == 17) // if it's 6 PM then change the sky from noon to sunset

{

podne_u_sumrak(128 * ticks_u_minuti);

}

if (sat == 19) // if it's 8 PM then change the sky from sunset to night

{

sumrak_u_noc(128 * ticks_u_minuti);

}

wait(1);

}

}


// put this function in your main() function if you want both features

function daytime_manager()

{

init_time();

change_sky();

}

Waves! [Re: Red Ocktober] #35887
01/19/05 08:21
01/19/05 08:21
Joined: Jun 2004
Posts: 241
muralist Offline
Member
muralist  Offline
Member

Joined: Jun 2004
Posts: 241
I still want to make the environment map cycle through day and night but have to say thanks for the waves code -- got it to work on the first try and its very nice. Thanks!!

Re: Waves! [Re: muralist] #35888
01/20/05 08:00
01/20/05 08:00
Joined: Oct 2002
Posts: 815
NY USA
R
Red Ocktober Offline
Developer
Red Ocktober  Offline
Developer
R

Joined: Oct 2002
Posts: 815
NY USA
my pleasure... and hey, if you get that real time day night thing working... give a hooler, would ya

that would really be a nice effect...

i am looking at some ideas along this line of thought as well... seeing as this is using static bmps i'm not sure as which way to proceed initially, but modifying the color to coincide with the 'ambient' color might be the solution...

... unless there is a way to change the bmp that is being used in the cubemapping on the fly. to be honest, i don't know enough about 3DGS and cscripting to do that just yet.

gimme a lil time though...

--Mike

Re: Waves! [Re: Red Ocktober] #35889
01/20/05 10:25
01/20/05 10:25
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
You can just use a differnt cubemap depending on what "time" it is.. this is easy enough. Make a function with a while loop like so:

function change_cubemap()
{
while(1)
{

if (timeofday==noon)
{
if (mat_water.skin1<>noon_cube)
{
mat_water.skin1=noon_cube;
}
}

//and so on
wait(10);
}

}

Re: Water Shader: Exchange the cube_map [Re: Matt_Aufderheide] #35890
01/23/05 18:54
01/23/05 18:54
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Quote:

in this shader it only relfects the skycube.. however if you own pro you can use render to texture to make it reflect everything.




How can I do that? Can you give me a code example?
Thank you.

Re: Water Shader: Exchange the cube_map [Re: old_bill] #35891
01/23/05 19:00
01/23/05 19:00
Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
XNASorcerer Offline
Expert
XNASorcerer  Offline
Expert

Joined: Dec 2001
Posts: 2,172
Portugal - Brazil
Quote:

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,

Can you should me how to do that? Thanks

Re: Released! - HLSL Water Code [Re: Steempipe] #35892
01/24/05 05:52
01/24/05 05:52
Joined: Aug 2002
Posts: 791
NRW, Deutschland
inFusion Offline
User
inFusion  Offline
User

Joined: Aug 2002
Posts: 791
NRW, Deutschland
Can I somehow tile the normal-map to make the waves smaller to use this code for a huge ocean?


"Wer nicht mit der Zeit geht, muss mit der Zeit gehen" - Bernd Stromberg
----
www.kihaki.de/reincarnation
Page 8 of 11 1 2 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