Page 1 of 1

Beam textures look like crap?

Posted: 18 Jul 2007, 02:55
by Zpock
When I try to use a custom texture for beam weapons, it dosn't seem to render correctly. As you can see only 2 colors are rendered, core and the noncore. The gradient in the texture is completly lost and the weak parts get cutout completly. I use the same texture in the alpha as the main texture. I tried different values for RGB color and intensity, still only a single color shows up (but different). Is there something I'm missing here or is the rendering code screwed up?

Image

Code: Select all

[MECHGUN]
	{
	ID=1;
	name=Rail Gun;
	rendertype=0;
	lineofsight=1;
	beamweapon=1;
	//beamlaser=1;
	laserflaresize=0.0001;
	duration=13.6;
	size=1;
	thickness=5.5;
	intensity=1;
	rgbcolor=0 0 1;
	corethickness=0.3;
	AvoidFriendly=0;
	CollideFriendly=0;
        accuracy=1;
        turret=1;
        burnblow=1;
        range=1000;
	impulsefactor=0;
        reloadtime=3; 
	weaponvelocity=1800;
	areaofeffect=1;
	energypershot=0;
        soundstart=mechplasma;
	soundhit=fnubeamhit;
	firestarter=1;
	tolerance=1;
	pitchtolerance=1;
	startsmoke=1;
	endsmoke=1;
	explosiongenerator=custom:RAILGUNHIT;
        interceptedbyshieldtype=1;
	noexplode=1;

	texture1 = railgun;
	texture2 = NULL;
	texture3 = NULL;
	texture4 = NULL;
        

	[DAMAGE]
		{
		default=500; 
                }
	}

Posted: 18 Jul 2007, 03:33
by Snipawolf
Huhmm, mine works.. Maybe I can steal that texture for you.

here are pics of mine.

texture Image

Ingame

Image

If noone posts, I'll edit after I use yours. If my weapon works with it, I'll just let you have my weapon script :-)

Posted: 18 Jul 2007, 03:38
by Zpock
Might be the texture format somehow? I used a .TGA with alpha an all... Maybe your just supposed to use a grayscale BMP or something? Must be square?

So can you give me:

WEapon script

Texture format used

to get it to work?

Posted: 18 Jul 2007, 03:44
by Snipawolf
Okay, lemme show you what I have.

My shockwave was .jpg with black and white, thats all. Seems to work. Yours however, works kinda like that (I also saved yours as a jpg).

One problem is that it is hardly visible with the nice texture you gave it :(

Image

So, I don't think you need any specific sizes (or multipliers of 2) because I copied it at the size it was at and used it, and it worked, so thats a surprise to me. I will probably still keep at 64x128 anyways, though.

Weapon file :

[Beam_Gun]
{
explosiongenerator=custom:PsiBomb;
name=Beam Gun;
rendertype=0;
Lineofsight=1;
turret=1;
range=1500;
duration=.4;
reloadtime=5;
weaponvelocity=550;
areaofeffect=64;
firestarter=50;
Intensity=10;
Thickness=10;
beamweapon=1;
texture1=railgun; //Zpock's railgun texture
texture2=kekeke;
RGBColor=0 0 1;
RGBCOLOR2=1 1 1;
accuracy=500;
sprayangle=400;

[DAMAGE]
{
default=180;
}
}
You don't need psibomb, although, It looks very good combined with your railgun. :P

Good luck, should work...

Posted: 18 Jul 2007, 03:54
by Snipawolf
Aha! I got it to work good! My colors were just too weak >.>

My bad, use these colors for best looks

RGBColor=0 0 1;
RGBCOLOR2=1 1 1;

Cough, like this!

Image

Looks better, but your texture still isn't gettin the attention it deserves!

Posted: 18 Jul 2007, 04:18
by Zpock
Ok, i tried chaning to JPEG and now it works. So the bug must be in the TGA code, or your not supposed to have an alpha, have to try withouth alpha channel TGA. Anyway now i can actually try to polish it.

Posted: 18 Jul 2007, 04:38
by Peet
No image alpha for that sort of thing...it's software controlled so having one in the file causes general borkage.

Posted: 18 Jul 2007, 05:15
by Argh
Yeah, please look at the bitmaps in NanoBlobs, they're sorted in Resources.tdf by whether alpha / non-alpha.

Posted: 18 Jul 2007, 06:27
by Zpock
After further experimenting I have concluded that it's impossible to have really clear saturated, intense colors. I guess the alpha is related to the sum of R+G+B so only pure white is 1.0 alpha and pure blue is 0.33. I tried intensity values over 1 dosn't seem to work, I think it's capped at 1. I tried combining the core and outer part of the beam with corethickness=1, and both set to RGB=(0,0,1), but this didnt seem to help much either. Not to mention trying to have really dark colours, black is automatically totally invisible. Anyone know a trick to do it?

Posted: 18 Jul 2007, 06:38
by hunterw
Zpock wrote:After further experimenting I have concluded that it's impossible to have really clear saturated, intense colors. I guess the alpha is related to the sum of R+G+B so only pure white is 1.0 alpha and pure blue is 0.33. I tried intensity values over 1 dosn't seem to work, I think it's capped at 1. I tried combining the core and outer part of the beam with corethickness=1, and both set to RGB=(0,0,1), but this didnt seem to help much either. Not to mention trying to have really dark colours, black is automatically totally invisible. Anyone know a trick to do it?
not that i know of, as the transparency is additive. that's why black is invisible - it's adding 0,0,0

Posted: 18 Jul 2007, 07:12
by Zpock
I tried stacking multiple beams on top of eachother with burst, and interestingly the colors mix such that with two beams ontop of eachother, the colors are still capped at the suspected 0.33 alpha, but white blends together until its 1.0 alpha and (1.0, 1.0, 1.0) RGB, pure solid white.

With the terrain, colours in the beam do add up. Blue beam over water will look pretty saturated for example.

I did come up with a way to do it tough.... by using a flare as the beam. But this isn't recommended, it clips badly, dosn't grow in the right way, and other bad stuff (altough it has some other advantages). It can be used to take fake glory screenshots tough, hehe.

Another idea I havn't tried yet, is using the borked beam you see at the top, mixed with a normal beam, it seems to actually have a solid blue.

Posted: 18 Jul 2007, 07:48
by KDR_11k
It's probably using alphatest and additive blending. Just use full alpha for the whole image.

Posted: 18 Jul 2007, 15:47
by rattle
If it's a laser then it's additive blending. That means remove the alpha channel and use a black background or it will look like what you have there.