Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (854)
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  
  Blurring an Anti-Arc?  (Read 2982 times)
0 Members and 1 Guest are viewing this topic.
Offline fiveten

Junior Newbie





« Posted 2009-07-15 03:24:00 »

Hey i am new to the forums.  I am currently developing an applet game with Java 2D.  Not sure if this was the right place to put this topic up but sorry if it was.  I am looking for anyway to blur the anti-arc of where a player is looking.  If you don't know what i am talking about i have some photoshop images. 

Normal transparent arc - ugly flashlight in horror games? ( Correct me on the correct term for this arc stuff idk what im even talking about)
http://game.swixi.com/zam2black.png

What i am looking for, Blurring the anti-arc
http://game.swixi.com/zam2blur.png

Any ideas would be helpful,  I have no clue how i would go about.  I was thinking if i could somehow copy part of the image and use ConvoleOp on it.  It would work correctly.  Problem is, idk how to copy a part of the image that is not a rectangle.  Oh well, help ploxxxx
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2009-07-15 06:29:18 »

You can clip with arbitrary shapes, but that's a bit slow. And blur is very slow. You certainly won't be able to do that in real time.

Well, with OpenGL and shaders things look different. But I'm not sure if the effect is any good. It looks more irritating than effective/atmospheric imo.

弾幕 ☆ @mahonnaiseblog
Offline Abuse

JGO Ninja


Medals: 70


falling into the abyss of reality


« Reply #2 - Posted 2009-07-19 22:16:49 »

I wouldn't say it's impossible to do it at real-time with Java2D, but I would expect it to be the bottleneck of your rendering code & highly resolution dependant.

Using ConvolveOp & a custom clip it should be fairly simple:

Take a copy of the portion of the arc you don't want blurred, (draw it onto a tmp image with an appropriately configured clip)
blur the whole of the original,
and copy back the unblurred portion you stored in the tmp image. (if your tmp image had transparency there will be no need for the custom clip on this draw)

Ofcourse, you might find you want the strength of the blur to increase the further outside the field of view a given pixel is..... you won't be able to do that with ConvolveOp.
If that's the case - you'll have to resort to manipulating the image on a per-pixel basis, bypassing the J2D pipeline altogether.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online CommanderKeith
« Reply #3 - Posted 2009-07-20 01:31:05 »

Rather than blurring maybe if you just painted a translucent dark grey image over the top it would look ok, be performant and achieve the same effect

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 123
Projects: 15


★★★★★


« Reply #4 - Posted 2009-07-20 01:45:37 »

i think left4kdead is a pretty good example of a flash light horror game using java2d http://www.mojang.com/notch/j4k/l4kd/

not sure how the spotlight effect is done there but it works well.
Offline fiveten

Junior Newbie





« Reply #5 - Posted 2009-07-20 04:21:56 »

How do you use the clip?  setClip will cut the image out? or only show that clip of image?
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1278 views)
2018-06-10 19:43:48

EgonOlsen (1146 views)
2018-06-10 19:43:44

EgonOlsen (881 views)
2018-06-10 19:43:20

DesertCoockie (1290 views)
2018-05-13 18:23:11

nelsongames (1106 views)
2018-04-24 18:15:36

nelsongames (1337 views)
2018-04-24 18:14:32

ivj94 (2077 views)
2018-03-24 14:47:39

ivj94 (1230 views)
2018-03-24 14:46:31

ivj94 (2188 views)
2018-03-24 14:43:53

Solater (796 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!