|
|
Getting the alpha value of a trace target
#169888
11/28/07 12:37
11/28/07 12:37
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
Is there a way to figure out the alpha value of a c_trace target or a world position? Edit: pixel_to_vec(COLOR* color,var alpha,var format,var pixel); How can I get the position of the pixel? When I use c_trace, I can use vec_for_uv to retrieve a vague position - but I need accurate positions, pixel precise. Or is there another, maybe easier approach? Edit2: Maybe this one will lead me to success: "hit.u1, hit.v1"  Edit3: Just to let you know, I´m trying to make the shadowbaker in Loopix´ Mysty Moods alpha compatible.  It should take the alpha values into account. Edit4: To me it seems, that hit.skin1 isn´t set by c_trace. But it should according to the beta page. Can someone confirm this? --> It´s only set when u use "SCAN_TEXTURE"
Last edited by fogman; 11/28/07 18:34.
|
|
|
Re: Getting the alpha value of a trace target
[Re: fogman]
#169889
11/28/07 21:01
11/28/07 21:01
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
Has no one a hint for me? I´ll go to bed, maybe I´ve some inspiration at night. 
no science involved
|
|
|
Re: Getting the alpha value of a trace target
[Re: fogman]
#169890
11/29/07 10:42
11/29/07 10:42
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
Ok, let´s make a brainstorming.  There are no bad or senseless ideas. How can we _maybe_ get the alpha value of a pixel in the world or object space?Thanks. 
no science involved
|
|
|
Re: Getting the alpha value of a trace target
[Re: ventilator]
#169892
11/29/07 12:53
11/29/07 12:53
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
I use Lite-C. Yes, it works when I use SCAN_TEXTURE. But now I´ve the problem that I can´t access hit.skin1 through pixel_to_vec. It leads to a crash, I think because hit.skin1 is a pointer but no real texture. Of course I´ve locked it and I´ve made sure that hit.u1 and hit.v1 are not located outside the texture.
no science involved
|
|
|
Re: Getting the alpha value of a trace target
[Re: fogman]
#169894
11/30/07 11:53
11/30/07 11:53
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
I´m feeling dumb already: Quote:
When c_trace() hits a level block or a model entity in OBB mode, the predefined hit.skin1 pointer is set to the hit BMAP (the lightmap or the first entity skin), and hit.u1,hit.v1 are set to the u,v coordinates of the hit point on the texture. This can be used to paint on the texture, add or remove shadows, or punch holes in targets with a gun.
How can I get the pixelvalue of the hit point? I´m getting crashes when I use pixel_to_vec. But according to the beta page it should be possible...
no science involved
|
|
|
Re: Getting the alpha value of a trace target
[Re: fogman]
#169895
12/08/07 06:34
12/08/07 06:34
|
Joined: Nov 2004
Posts: 862 Australia
DavidLancaster
User
|
User
Joined: Nov 2004
Posts: 862
Australia
|
I'm playing around with all this sort of stuff at the moment...it's pretty tricky when using pixel_to_vec...are you locking the bmap? I can get it working without crashing: Code:
format = bmap_lock(bmap_terrain_lightmap,0); if (format >= 565) { pixel = pixel_for_bmap(bmap_terrain_lightmap,hit.u1,hit.v1); pixel_to_vec(color.blue,result,8888,pixel); }
|
|
|
Re: Getting the alpha value of a trace target
[Re: DavidLancaster]
#169897
12/08/07 07:20
12/08/07 07:20
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
OP
Expert
|
OP
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
Exactly the same as me.  As soon as I try to use SCAN_TEXTURE. My level contains only models.
Last edited by fogman; 12/08/07 07:21.
no science involved
|
|
|
|