Quake3World.com Forums
     Level Editing & Modeling
        Shader for an animated explosion


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Shader for an animated explosion

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 09-21-2014 01:41 PM           Profile Send private message  E-mail  Edit post Reply with quote


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:
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.




Top
                 

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 09-21-2014 01:51 PM           Profile Send private message  E-mail  Edit post Reply with quote


Just to let you guys know: i have updated my engine code to support 32 frames. Changed MAX_IMAGE_ANIMATIONS to 32.




Top
                 

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 09-21-2014 07:30 PM           Profile Send private message  E-mail  Edit post Reply with quote


Can't help without pics...




Top
                 

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 10-26-2014 05:07 AM           Profile Send private message  E-mail  Edit post Reply with quote





Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 10-26-2014 05:24 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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:
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.



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 10-26-2014 05:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


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?




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 10-26-2014 07:07 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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 :)



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 10-26-2014 09:54 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 10-26-2014 11:00 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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)...



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

Grunt
Grunt
Joined: 20 Feb 2011
Posts: 57
PostPosted: 10-26-2014 12:56 PM           Profile Send private message  E-mail  Edit post Reply with quote


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).




Top
                 

Theftbot
Theftbot
Joined: 07 Oct 2009
Posts: 483
PostPosted: 10-26-2014 08:08 PM           Profile Send private message  E-mail  Edit post Reply with quote


RoQ




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 10-27-2014 12:35 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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.



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

The Afflicted
The Afflicted
Joined: 14 Oct 2001
Posts: 581
PostPosted: 10-29-2014 03:22 AM           Profile Send private message  E-mail  Edit post Reply with quote


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




Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.