Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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: fogman] #169891
11/29/07 11:21
11/29/07 11:21
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
hit.u1, hit.v1 was the correct idea. did you try it with c-script or with lite-c?

it could get a bit tricky though if you trace through a lot of transparent polygons. you would have to recursively call c_trace() again and again until the ray reaches its destination.

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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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] #169893
11/29/07 13:12
11/29/07 13:12
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Is there a way to get the source texture of hit.skin1? I´ve done some tests, but I wasn´t able to receive the filename so far.


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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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 Offline
User
DavidLancaster  Offline
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] #169896
12/08/07 06:45
12/08/07 06:45
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline
User
DavidLancaster  Offline
User

Joined: Nov 2004
Posts: 862
Australia
Are you tracing a model or bsp?

I get an engine crash using 'scan_texture', my levels are models, I'm trying to get the hit.u1 and v1 values.

result = c_trace(vector(my.x,my.y,my.z + my.min_z),vector(my.x,my.y,my.z - 4000),IGNORE_ME|IGNORE_PASSABLE|SCAN_TEXTURE);

Any ideas?

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
F
fogman Offline OP
Expert
fogman  Offline OP
Expert
F

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
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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