3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Initializing Color  (Read 253 times)

« on: May 05, 2014, 08:13:01 AM »
Hi.

I wrote selected color Script and work very well. I want set one color for each car. (e.g: Dyane = Brown, BMW = Yellow, ...). I wrote this script for set custom color after first run but all cars get one color.(All cars Get color of the First car.)
Please Gude Me for fix it

Thanks.

Code: [Select]
void Main()
{
   if (iInitializing ())
   {
      iShaderFloat3Set(OBJ_0,"cColor", 0.55, 0.39, 0.66);
      iShaderFloat3Set(OBJ_22,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_44,"cColor", 0.0, 0.60, 0.30);
      iShaderFloat3Set(OBJ_66,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_88,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_110,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_132,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_154,"cColor", 1.0, 1.0, 1.0);
   }
}
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #1 on: May 05, 2014, 09:39:10 AM »
me thinks you found a bug that i also found when coloring text on screen.

with the textprint object, when you define different colors in script for say 3 text prints all in one loop, only the last one defined is used for all the text print from that object.

I'm guessing something similar is happening here where only one defined color is used per script loop.

I would suggest separating each color into it's own loop like this.

 
Code: [Select]
iShaderFloat3Set(OBJ_0,"cColor", 0.55, 0.39, 0.66);
wait for half a sec or use a counting loop like
counter1+=0.01;
if(counter1>0.4)iShaderFloat3Set(OBJ_22,"cColor", 1.0, 1.0, 1.0);
if(counter1>0.8)iShaderFloat3Set(OBJ_44,"cColor", 0.0, 0.60, 0.30);

if(counter1>2.0)counter1=0;

and run this loop maybe every script cycle if it works or needs to be every script cycle.

« Reply #2 on: May 05, 2014, 11:03:36 AM »
Try to remove the iInitializing() function. Just leave the iShaderFloat3Set() functions alone like:

Code: [Select]
void Main()
{
      iShaderFloat3Set(OBJ_0,"cColor", 0.55, 0.39, 0.66);
      iShaderFloat3Set(OBJ_22,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_44,"cColor", 0.0, 0.60, 0.30);
      iShaderFloat3Set(OBJ_66,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_88,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_110,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_132,"cColor", 1.0, 1.0, 1.0);
      iShaderFloat3Set(OBJ_154,"cColor", 1.0, 1.0, 1.0);
}

Works, bro, 100% I've tried it many times.
If we don't give up we can achieve the unthinkable!
« Reply #3 on: May 05, 2014, 12:57:21 PM »
everything's a bug...  right... 3DRAD is at fault for every failing that we can imagine...

maybe, the fault lies in ourselves, and not in 3DRAD...

the height of absurdity is to imagine that the first thing that someone does when confronted with a problem is to throw up their hands and assume that the fault must be in something beyond their control... yet so many people's minds operate in this fashion...

i never will understand this...



there's nothing wrong with RAD here...

first of all, i must assume that the original poster is trying to change the color of a skinmesh, and not that of a car object...

if this is indeed the case, then a quick review of the system shaders and how to apply them should clear up his confusion...
the skinmesh must use a user_shader_type...  0014, 0015, etc... the default shaders won't work with the function he is using...


second... the code...
you need to take the instructions out of the init clause... it must happen each main loop cycle...

i think that both of these facts are documented...


--Mike
« Reply #4 on: May 05, 2014, 01:32:13 PM »
yes the text print is a bug in my view mike.

Thankyou so much much for chiming in with your sarcastic point of view.. thats very helpful on the forum..

I would love to exchange words with you, but, i've been there , done that, not going there again cause it doesn't help anyone.

A piece of script to prove a point wrong would be much more helpful to all in involved, rather than just trying to put somebody down with a comment and not proving what you say.
 

By that i mean, prove my text print "bug" wrong, PLEASE.
« Reply #5 on: May 05, 2014, 04:05:30 PM »
You can define the colours for objects as Mike says, must be called within main loop and only on a _user shader.
For textprints if you use separate textprints you can define as many colours as you like in one loop, but I think you are trying to change the colour of ONE textprint multiple times in a loop - the colour only changes at the end of a loop so this can't be done (afaik), I wouldn't necessarily call it a bug, more just the way RAD works
« Reply #6 on: May 05, 2014, 04:23:30 PM »
as usual you take everything personally Tin... as if it were meant to insult you...

and though i'm sure you would love to mince words, you have no words to mince...
you only a lesson to learn... one which i would've thought, seeing as you've been
around as long as you have, would've been learned loooooong ago...

that's as much as need be said on that point...

as for the text print bug you continue to babble about... stop for a second... read the help file...
reevaluate your logic...

why would you need to enclose them within a loop in the first place... addressing the individual objects in a loop would be pointless, and since they are not using a user_shader_xxx, using the shader floats to change the colors won't work...

the obvious solution is to simply set the colors (as the help file tells you) by setting the appropriate OUT_xxx values...

like so...

Code: [Select]
void Main()
{
      //                     set text print object 1 to red
      OUT_1=1.0; OUT_2=0.0; OUT_3=0.0;
      //                     set text print object 2 to green
      OUT_23=0.0; OUT_24=1.0; OUT_25=0.0;
      //                     set text print object 3 to blue
      OUT_45=0.0; OUT_46=0.0; OUT_47=1.0;
}



so much for any 3DRAD text print bug...
again... the truth lies not in the stars, but in ourselves...

3DRAD is not at fault here... it's you...

--Mike

« Last Edit: May 05, 2014, 04:35:52 PM by Mike Hense »
« Reply #7 on: May 05, 2014, 06:00:26 PM »
my point stands..

you cant define different colored text printed on screen at the same time using one  text print object.

of course you can change the text print objects color runtime.. but not in a way that would define multiple text colors printed on screen at the same time with only one text print object.

i suggested the loop timing process because i came across an issue with animated sprites ( frames) not being changed and displayed during each script cycle.

for instance, i have a program im working on, when you click a screen button ( sprite) in script it's set to change animation frame.

Then the program downloads a file from the internet.

Problem is the sprite frame is updated properly before the download begins, but all this happens in one script loop.

So apparently the sprite frame update doesn't get applied to the sprite and it's not seen on screen till the file download completes.

So i found out that if change the sprite frame then apply a timed delay of a few engines cycles to allow the change on screen to be seen, then do the file download..

The button works as i wanted it to.

I blame the file download function for interrupting 3drad till it finish's.

That was what was going through my head when i suggested using a timed loop to allow 3drad to full process the colors for each object before moving to the next object.

With the textprint object this can or will cause color flickering.
« Reply #8 on: May 05, 2014, 06:53:02 PM »
you're an idiot...  ;D  ;D  ;D

--Mike
« Reply #9 on: May 06, 2014, 11:32:26 AM »
Thanks All for help.

if I try use them in main loop can't change color because always show current color.also I use Shader 0016 for change skin Mesh Color. I Need set one color in first run that will could change colors.
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #10 on: May 17, 2014, 03:04:19 AM »
Can anyone show me with this Project how 2 skin Mesh can different color at First run?
one skin mesh is hide and when show, don't change color.

I need Help for fix this Problem.I can't use iShaderFloat3Set in Main loop because I will can't change color again.

Thanks.
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #11 on: May 18, 2014, 12:10:20 AM »
Hi beha....... This should help

n_iron
« Reply #12 on: May 18, 2014, 01:15:39 AM »
Hi and Thanks n_iron :D

but I need change the color of the car that is hidden (mean when shown change the color).
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
Pages: [1]