Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 02:15:19 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Additive blending
Pages: [1]
Print
Author Topic: Additive blending  (Read 832 times)
BrazilianBoy
Becoming dependent
**
Offline Offline

Posts: 208


l_p_camargo@hotmail.com
View Profile Email
« on: 28. November 2007, 10:30:41 pm »

I managed to put a little sparkle on the screen using a texture that I made with Blender and a rect billboard. But if I don't use additive blending, the result won't look realistic. How can I turn it on (if it's currently possible)?

Lucas.
Logged

Getting my hands dirty Smiley
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 28. November 2007, 10:41:30 pm »

I managed to put a little sparkle on the screen using a texture that I made with Blender and a rect billboard. But if I don't use additive blending, the result won't look realistic. How can I turn it on (if it's currently possible)?

I guess, you want to add an instance of TransparencyAttributes to the billboard's Appearance. This will enable OpenGL to correctly blend a (half) transparent texture.

Code:
bb.getAppearance().setTransparencyAttributes( new TransparencyAttributes( 0f ) );
should do the trick.

Marvin
Logged
BrazilianBoy
Becoming dependent
**
Offline Offline

Posts: 208


l_p_camargo@hotmail.com
View Profile Email
« Reply #2 on: 28. November 2007, 10:49:41 pm »

I guess, you want to add an instance of TransparencyAttributes to the billboard's Appearance. This will enable OpenGL to correctly blend a (half) transparent texture.

Not exactly. This is done. I want not to blend both the source and destination colors, but add them when writing to the color buffer. This add would never "fade" the colors when blending, then my sparkle would look like light, not a blurred point.


Lucas.
Logged

Getting my hands dirty Smiley
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 28. November 2007, 10:55:28 pm »

Not exactly. This is done. I want not to blend both the source and destination colors, but add them when writing to the color buffer. This add would never "fade" the colors when blending, then my sparkle would look like light, not a blurred point.

Hmm... Wouldn't that mean to make the lightening "lines" opaque?

Well, I guess, you have to use RenderingAttributes and/or TextureAttributes. But I have never "really" used them. So I cannot provide you more tips than the JavaDocs will give you. Good luck Smiley.

Marvin
Logged
BrazilianBoy
Becoming dependent
**
Offline Offline

Posts: 208


l_p_camargo@hotmail.com
View Profile Email
« Reply #4 on: 28. November 2007, 10:56:37 pm »

Ok, I should think a little deeper before posting here. I've already found the solution.
I have to set the Dst blend factor to one.

Thank you  Wink
Logged

Getting my hands dirty Smiley
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic