Different background color on different views

Posted By: BoH_Havoc

Different background color on different views - 09/30/10 17:19

Hi,
i was wondering how one could apply a different background/sky_color to different views?
I need a black sky for one of my shaders, but on the other hand, i also need a pure white one for another shader...so i have a problem here, as i can't use sky_color.

View1 = black sky/background
View2 = white sky/background

Any ideas? laugh
Posted By: jane

Re: Different background color on different views - 09/30/10 18:03

if(render_view == View1) {vec_set(sky_color,vector(0,0,0))};
if(render_view == View2) {vec_set(sky_color,vector(255,255,255))};

or use you the different views simultaneous?
Posted By: EvilSOB

Re: Different background color on different views - 09/30/10 18:59

There is probably a much better way of "getting" the colors than this,
but the " view.dwcolor = " MAY enable you to set the different colors.

Code:
// generate the color "codes"
long long_white;
long long_black;

void main()
{  
   ...
   vec_set(sky_color, vector(255,255,255));  long_white = camera.dwcolor;
   vec_set(sky_color, vector(0,0,0));        long_black = camera.dwcolor;
   vec_set(sky_color, [i]normal[/i]);
   ...
   ...
   View1.dwcolor = long_black;
   View2.dwcolor = long_white;
...


Posted By: BoH_Havoc

Re: Different background color on different views - 09/30/10 19:53

jane:
I already tried that method, but it's VERY unflexible and makes life much harder for me. Each time i need another background color i would have to rewrite code all over the place. I also would have to set the ENABLE_VIEW flag for each material, which i absolutely do not want.
Yes, i render both views (i actually have more) at the same time...so this really is unflexible.

EvilSOB:
That's exactly what i was looking for. A simple and easy method to change the background without rewriting all my code. Unfortunally it doesn't work frown Would have been to easy...

Any more ideas? laugh
Posted By: jane

Re: Different background color on different views - 09/30/10 20:17

its an option to use the screen_color(default:0 -> black) to View1 and sky_color to View2

or target1,target2,target3 with COLOR1,COLOR2,COLOR3
to change the bmap_createblack color?
Posted By: Zapan@work

Re: Different background color on different views - 10/05/10 13:14

We used something like that for our splittscreen game: just create a view-entity (skycube etc.) and asign the client_id of the ent to the view... this works just fine!
Posted By: Petra

Re: Different background color on different views - 10/05/10 13:28

They just have implemented background colors in beta a week ago:

Quote:
The bg parameter allows to clear a VIEW to a certain value.

It seems Conitec needed different background colors for the new PSSM script, its always good when they do such scripts because then they notice whats missing.
© 2024 lite-C Forums