Shader for an animated explosion

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Shader for an animated explosion

Post by vinny »

I have created an animated explosion using this software and exported it as series of transparent PNG's. I'm using the ioquake engine and i have replaced the rlboom animation (rocket launcher gfx) with mine. However, it's not rendered normally... the colors are wrong and there are lot's of artifacts. Here's my shader:

Code: Select all

animmap 32 models/weaphits/rlboom/rlboom01.png models/weaphits/rlboom/rlboom02.png models/weaphits/rlboom/rlboom03.png models/weaphits/rlboom/rlboom04.png models/weaphits/rlboom/rlboom05.png models/weaphits/rlboom/rlboom06.png models/weaphits/rlboom/rlboom07.png models/weaphits/rlboom/rlboom08.png models/weaphits/rlboom/rlboom09.png models/weaphits/rlboom/rlboom10.png models/weaphits/rlboom/rlboom11.png models/weaphits/rlboom/rlboom12.png models/weaphits/rlboom/rlboom13.png models/weaphits/rlboom/rlboom14.png models/weaphits/rlboom/rlboom15.png models/weaphits/rlboom/rlboom16.png models/weaphits/rlboom/rlboom17.png models/weaphits/rlboom/rlboom18.png models/weaphits/rlboom/rlboom19.png models/weaphits/rlboom/rlboom20.png models/weaphits/rlboom/rlboom21.png models/weaphits/rlboom/rlboom22.png models/weaphits/rlboom/rlboom23.png models/weaphits/rlboom/rlboom24.png models/weaphits/rlboom/rlboom25.png models/weaphits/rlboom/rlboom26.png models/weaphits/rlboom/rlboom27.png models/weaphits/rlboom/rlboom28.png models/weaphits/rlboom/rlboom29.png models/weaphits/rlboom/rlboom30.png models/weaphits/rlboom/rlboom31.png models/weaphits/rlboom/rlboom32.png
blendfunc blend
rgbGen entity
Any ideas how to fix this? Also, how can i fix the explosion animation clipping? If it explodes near a wall, part of it is clipped.
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Shader for an animated explosion

Post by vinny »

Just to let you guys know: i have updated my engine code to support 32 frames. Changed MAX_IMAGE_ANIMATIONS to 32.
KittenIgnition
Posts: 252
Joined: Sun Nov 06, 2011 11:11 pm

Re: Shader for an animated explosion

Post by KittenIgnition »

Can't help without pics...
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Shader for an animated explosion

Post by vinny »

User avatar
CZghost
Posts: 1931
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: Shader for an animated explosion

Post by CZghost »

So far: You are using PNG that is not normally supported. If you want to share it for VQ3, change it to TGA or JPG. You probably have no alpha channel in it. Change blendFunc blend to blendFunc add (or blendFunc GL_ONE GL_ONE, it is the same as add), it will make the texture matematically added to the background. Alpha blending is usable for vents, not special effects like explosions or fire, there should be additive blending, not blending based on alpha channel. Hope this will help you so much. For clarify, I post you new piece of shader now:

Code: Select all

animmap 32 models/weaphits/rlboom/rlboom01.tga models/weaphits/rlboom/rlboom02.tga models/weaphits/rlboom/rlboom03.tga models/weaphits/rlboom/rlboom04.tga models/weaphits/rlboom/rlboom05.tga models/weaphits/rlboom/rlboom06.tga models/weaphits/rlboom/rlboom07.tga models/weaphits/rlboom/rlboom08.tga models/weaphits/rlboom/rlboom09.tga models/weaphits/rlboom/rlboom10.tga models/weaphits/rlboom/rlboom11.tga models/weaphits/rlboom/rlboom12.tga models/weaphits/rlboom/rlboom13.tga models/weaphits/rlboom/rlboom14.tga models/weaphits/rlboom/rlboom15.tga models/weaphits/rlboom/rlboom16.tga models/weaphits/rlboom/rlboom17.tga models/weaphits/rlboom/rlboom18.tga models/weaphits/rlboom/rlboom19.tga models/weaphits/rlboom/rlboom20.tga models/weaphits/rlboom/rlboom21.tga models/weaphits/rlboom/rlboom22.tga models/weaphits/rlboom/rlboom23.tga models/weaphits/rlboom/rlboom24.tga models/weaphits/rlboom/rlboom25.tga models/weaphits/rlboom/rlboom26.tga models/weaphits/rlboom/rlboom27.tga models/weaphits/rlboom/rlboom28.tga models/weaphits/rlboom/rlboom29.tga models/weaphits/rlboom/rlboom30.tga models/weaphits/rlboom/rlboom31.tga models/weaphits/rlboom/rlboom32.tga
blendfunc GL_ONE GL_ONE
rgbGen entity
Copy it to your shader prepared for the rocket hit.
[ Linktree | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Shader for an animated explosion

Post by vinny »

But ioq3 says in it's documentation that PNG's are supported. I tried using 24-bit transparent PNG's, as well 8-bit PNG's. In the shader, i have used blendfunc blend for the PNG's. I also tried TGA's with alpha channel transparency, no luck.

However, i have also saved the textures as JPG's with black background and used blendfunc add. This didn't make the black background disappear, it was still there. Is there any trick with JPG's?
User avatar
CZghost
Posts: 1931
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: Shader for an animated explosion

Post by CZghost »

IOquake3 is not Vanilla Q3. I said Vanilla Q3 does not support PNG by default, I did not say anything about three party addons. Shaders always need to have image extension being replaced by tga as this is native format for Q3. It always looks for JPG as alternative format when TGA is not available for some reason (missing file or not readable).

If you make some engine changes, you need to put then in its own modification directory, if you compiled only vm's. Replacing baseq3 stuff is bad idea, this always will lead to textures leaks. If you made your own exe, make sure your weapon hit texture is also in separated pk3 and in separated mod folder, otherwise it will cause the same flaw as the first state.

Hope it has explained your problem :)
[ Linktree | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Shader for an animated explosion

Post by vinny »

ioq3 is a little bit different, though. The engine can read PNG, TGA and JPG. Transparency is supported as well, but maybe i'm missing something in the shaders.

BTW I'm not using custom QVM, just a modified version of the renderer to support more than 8 animmap frames. On top of the latest ioq3 master.
User avatar
CZghost
Posts: 1931
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: Shader for an animated explosion

Post by CZghost »

Besides that, I always would recommend you to make additionaly a mod folder for that. Do not place it in baseq3 (or what is your base mod named), place it somewhere on the side to avoid that flaw. Your shader is good, just modify the blendfunc mode to add and replace .png to .tga (it do not make that sense, but it is better that when you decide to make TGA with alpha, you do not need to replace the extension with new one)...
[ Linktree | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Shader for an animated explosion

Post by vinny »

I changed to a custom mod folder and also changed to TGA. I tried both TGA with and without alpha, with and without blendfunc add, without any luck. Still no transparency. That is the issue.

I have tried:

- Transparent 24-bit PNG
- Transparent 8-bit PNG
- JPG with black background
- TGA with black background
- TGA 16-bit with alpha channel transparency
- TGA 24-bit with alpha channel transparency
- TGA 32-bit with alpha channel transparency

All of them with combinations of:

- blendfunc add
- blendfunc blend
- alphaGen entity
- alphaGen const 1.0
- alphaGen const 0.0

I always end up with an animation with either a black or white background (white in the case of PNG's).
User avatar
Theftbot
Posts: 483
Joined: Thu Oct 08, 2009 4:03 am

Re: Shader for an animated explosion

Post by Theftbot »

RoQ
User avatar
CZghost
Posts: 1931
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: Shader for an animated explosion

Post by CZghost »

Theftbot, you hit it :) However RoQ must be placed in video folder, otherwise it won't work. Also it will display in cinematics section in the game, which is pretty unwanted. I don't know what will do placing RoQ in weapon hit texture. I think it has some rules what can be modified by what. If you really need to increase the maximum textures in animation, read the source code documentation carefuly first, there should be described changes that will affect engine and how to change something to get change working. If not, you would like to contact id Software to advice in increasing maximum animation frames. RoQ is great for making map videotexture (for example map movies in Team Arena) or new cinematic, not for special effects. It also has not so much good quality as using individual texture frames for animation, hovewer limited for 8 per shader stage.
[ Linktree | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Shader for an animated explosion

Post by dONKEY »

You getting any warning in the console?
Sounds rather like Q is not finding the textures.
Post Reply