Traceline color to particle color?
-
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
Traceline color to particle color?
Is it possible to get a color using a traceline, and spawn a particle with effectinfo.txt using that traced color? I know there is a bulitiin in Darkplaces to get a pixel color from a traceline, but I'm not sure if that data can be passed over to a particle in effectinfo.txt
Re: Traceline color to particle color?
mmm i do not understand
for a visible traceline i spawn a new entity "owned" to the player else:
you can change the string "visibletraceline_red" for antoher
for a visible traceline i spawn a new entity "owned" to the player else:
Code: Select all
trailparticles(self, particleeffectnum("visibletraceline_red"), self.owner.origin, self.origin);
hi, I am nahuel, I love quake and qc.
-
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
Re: Traceline color to particle color?
say there's a dirt texture and you want to get the color of that dirt and turn that color into a particle effect in real time. is that possible?
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Traceline color to particle color?
Reading the corresponding entry in the Darkplaces Wiki I'd say it's very unlikely you can redefine effectinfo.txt on-the-fly. But I may be wrong...
EDIT: OTOH, You could define 16 similar particle effects, changing only the color range to match every color row in Quake default palette, and select which one is used based on what the pixel check returns. At least you wouldn't have brown particles when hitting a blue/red/yellow/green texture.
EDIT: OTOH, You could define 16 similar particle effects, changing only the color range to match every color row in Quake default palette, and select which one is used based on what the pixel check returns. At least you wouldn't have brown particles when hitting a blue/red/yellow/green texture.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
Re: Traceline color to particle color?
Hello Mexicouger,
I also think that it is not possible to detect a color in the world and "create" a matching effect via effectinfo.
You COULD do it this way (because you use DP and can therefore also use other dpextensions):
Nahuel did this once in one of his amazing mods.
And also footsteps sound can be done this way to get different sounds according the texture you are walking on.
This is something Moon[drunk] was working on, but as far as I know didnt finish it (yet).
Detect the texture you are shooting at, via
DP_QC_GETSURFACE
Then (depending on how many textures you use in your maps) make checks accordingly and spawn an already existing effect with the color of texture.
Be aware that you can create hundreds effects in your effectinfo, there seems to be no limit.
Example:
When your texture-check results in "city1_4" then you would spawn effectnum "middle_brown"
("middle_brown" is declared in your effectinfo.txt)
For many Quake textures you can use similar effectnums, because they share almost the same color.
This means a quite big one-time-effort in creating the texture-checks (depending on how many you use in your maps),
but in the end it might work as you want.
Good luck,
Seven
PS: If this is not what you asked for, then I am sorry. I also have issues with english sometimes...
I also think that it is not possible to detect a color in the world and "create" a matching effect via effectinfo.
You COULD do it this way (because you use DP and can therefore also use other dpextensions):
Nahuel did this once in one of his amazing mods.
And also footsteps sound can be done this way to get different sounds according the texture you are walking on.
This is something Moon[drunk] was working on, but as far as I know didnt finish it (yet).
Detect the texture you are shooting at, via
DP_QC_GETSURFACE
Then (depending on how many textures you use in your maps) make checks accordingly and spawn an already existing effect with the color of texture.
Be aware that you can create hundreds effects in your effectinfo, there seems to be no limit.
Example:
When your texture-check results in "city1_4" then you would spawn effectnum "middle_brown"
("middle_brown" is declared in your effectinfo.txt)
For many Quake textures you can use similar effectnums, because they share almost the same color.
This means a quite big one-time-effort in creating the texture-checks (depending on how many you use in your maps),
but in the end it might work as you want.
Good luck,
Seven
PS: If this is not what you asked for, then I am sorry. I also have issues with english sometimes...
Re: Traceline color to particle color?
use frikfile to over write the .txt file?
-
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
Re: Traceline color to particle color?
Unfortunately, this is what I already did before I asked here. I was really crossing my fingers for a shortcut for it.Seven wrote:Hello Mexicouger,
I also think that it is not possible to detect a color in the world and "create" a matching effect via effectinfo.
You COULD do it this way (because you use DP and can therefore also use other dpextensions):
Nahuel did this once in one of his amazing mods.
And also footsteps sound can be done this way to get different sounds according the texture you are walking on.
This is something Moon[drunk] was working on, but as far as I know didnt finish it (yet).
Detect the texture you are shooting at, via
DP_QC_GETSURFACE
Then (depending on how many textures you use in your maps) make checks accordingly and spawn an already existing effect with the color of texture.
Be aware that you can create hundreds effects in your effectinfo, there seems to be no limit.
Example:
When your texture-check results in "city1_4" then you would spawn effectnum "middle_brown"
("middle_brown" is declared in your effectinfo.txt)
For many Quake textures you can use similar effectnums, because they share almost the same color.
This means a quite big one-time-effort in creating the texture-checks (depending on how many you use in your maps),
but in the end it might work as you want.
Good luck,
Seven
PS: If this is not what you asked for, then I am sorry. I also have issues with english sometimes...
Right now, I use trace_dphittexturename to get the name of the texture, and run my already-created particle effect. It would be much easier to be able to change the color on the fly, but It can be done either way. Thanks anyway guys
Re: Traceline color to particle color?
If I did this in Engoo i'd probably try to sample the average color for every texture loaded (at load time), and keep that averaged color as part of the mips themselves.
SiN did something similar in which it remapped little gunshot debris chunk models with the texture iself.
SiN did something similar in which it remapped little gunshot debris chunk models with the texture iself.
Last edited by leileilol on Fri Apr 12, 2013 9:45 pm, edited 2 times in total.
i should not be here
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Traceline color to particle color?
I suspect DP won't reload effecinfo.txt.ceriux wrote:use frikfile to over write the .txt file?
It would be interesting to have the ability to redefine an effect via QC though (or for extension any shader).
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
Re: Traceline color to particle color?
cant frikfile also load files? but im sure ur right...
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Traceline color to particle color?
"Load" means "parse" here, and it's very unlikely that DP does it more than once at startup. BUT, as I said, I may be wrong...ceriux wrote:cant frikfile also load files? but im sure ur right...
I'd suggest to go with the 16 or so colors particles and check which one is closer to the pixel color in the texture.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)