Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Need help performing additive blending in Java2D  (Read 2966 times)
0 Members and 1 Guest are viewing this topic.
Offline Vey

Senior Newbie





« Posted 2009-02-10 13:47:16 »

I am making a 2D graphics engine using Java2D and I'm in need of help. I want to perform additive blending on my particles but I can not find a way that is fast enough for real-time drawing. Any hints?

I might also be interested in using the transparent pixels stored by photoshop and then replace my black-ish pixels with those.

For those who do not know what additive blending does, it "adds" the value of a pixel to draw to the pixel it's drawing to and thus a part of a picture will seem more transparent depending on how black it is since black==0.
Offline CommanderKeith
« Reply #1 - Posted 2009-02-10 14:04:39 »

Maybe try this library:

http://download.java.net/javadesktop/scenario/effects/releases/0.4.9/javadoc/com/sun/scenario/effect/Blend.Mode.html

It has additive blending, and it can be accelerated by the java2d d3d pipeline.

I've used it once just to test it out and it worked pretty good, but I didn't use additive blending, i just used the bloom effect.


Offline Vey

Senior Newbie





« Reply #2 - Posted 2009-02-25 14:41:09 »

That does indeed look promising, but I can't seem to find a way to download it. I've talked to some teachers in school but after checking they all seem pretty clueless as well. One mentioned that it is included in the J3D package, but I checked and it wasn't in there.

I've obviously googled and checked the link for downloads but with no luck. So where can I get it? Thank you!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Wildern

Junior Duke





« Reply #3 - Posted 2009-02-25 18:40:10 »

Hitting Google up for "com.sun.scenario" yielded a link that I shortened to get this one
http://download.java.net/javadesktop/scenario/releases/0.5/
Offline brackeen

Junior Duke





« Reply #4 - Posted 2009-02-25 21:51:15 »

I think the problem is Scenario treats blend modes like an image filter (requires an input image, returns an output image), rather than just selecting the blend mode in Graphics2D like you would SrcOver or Xor.

Something called PhotoComposite got mentioned once - anyone know if it's going to make it into JDK 7?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6541868
Offline CommanderKeith
« Reply #5 - Posted 2009-02-26 04:14:27 »

Sun java2D engineer Chris Campbell mentioned it in his blog a while back, but I haven't seen anything since. I've got a feeling that the JavaFX work is taking priority for the time being:

http://weblogs.java.net/blog/campbell/archive/2007/04/faster_java_2d.html
Coming Soon: PhotoComposite
It's not officially approved (or integrated) yet, but I've been working on adding more blending modes to Java 2D, in addition to those already provided by AlphaComposite. Many of these modes come from traditional photography techniques, thus the name "PhotoComposite". Some modes are simple (Add, Multiply) and can be accelerated easily using OpenGL's built-in blending rules, others are more involved (ColorBurn, SoftLight) and benefit greatly from the use of shaders for efficient rendering.


Offline zammbi

JGO Coder


Medals: 4



« Reply #6 - Posted 2009-02-26 05:23:57 »

There was also this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5094232

Which also says that they were going to try do "average, darken, lighten, color burn/dodge" for Java 7.

But if you want to do your own code for now there was this : http://www.java-gaming.org/topics/fastest-color-addition-with-clamp-0-255-of-rgb/18379/view.html

Current project - Rename and Sort
Offline Vey

Senior Newbie





« Reply #7 - Posted 2009-02-27 22:48:10 »

Thank you, I managed to import the package, gonna experiment with it tomorrow Smiley

Also yeah, PhotoComposite seems pretty interesting!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!