Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  Light effects help wanted.  (Read 2569 times)
0 Members and 1 Guest are viewing this topic.
Offline TexMurphy

Senior Newbie




Java games rock!


« Posted 2003-07-13 14:41:02 »

Hia guys.

More questions from the stoopid noob. Wink

I have been playing around alot with light for the last week. Light beeing so damn important and making things go from dead and booring to alive and kicking I need to learn alot about light effects.

What I have done so far is that I have been using PointLight that comes from one corner of the univers and lights everything. This creates nice shadows ony my asteroid fields. With different collors to the Ambient light it starts to look really nice.

Though I have a few questions about other effects and how to make them.

1. Light comming from within spheres and cylinders. I would like to create glowing spheres to create blinking lights on stations, ships and other objects. Ive been playing around with this placing PointLight into a sphere and making it transparent but somehow this doesnt work for me. Next step is to do same thing with cylinders to create laser beams. My idea is here to have a very think cylinder and to get it to glow to make more atmosphearic laser shot effects.

Anyone know how to do this (make shapes glow) or have sample code?

2. Lens flares. To create light sources that represent the star(s) in the system Id like to use glowing objects that create a lens flare. This I have no clue what so ever on how to do. Any advice?

Thanks in advance.
Tex.
Offline Breakfast

Senior Member




for great justice!


« Reply #1 - Posted 2003-07-13 18:08:45 »

I went through this a little while ago- first up - if a light source is as far away as a star you may as well use a DirectionalLight rather than a PointLight- the effect is similar, but it seems to me that it should be less calculation heavy - I have no evidence for this, though, could be completely wrong.

Secondly, it is disappointing to discover that lights you see in games are all smoke and mirrors. Whenever you see any kind of visible light source in a game, what you have is a picture of a light source on an alpha blended texture in front of a light. In OpenGL and as a result in any rendering library built over it, the only things that are visible are polygons. Lights have an effect on visible polygons but are not themselves visible.

If you are looking at distant stars in a space scene it isn't worth using real light sources for it - especially as you are limited to 8 light sources anyways - just use pictures of stars to create the backdrop. When you see a light with lens flare  ( bit of an aside - I know it's expected, but you only really need lens flare if there is a lens of some sort for it to flare in...) what you have is a series of alpha-blended circles being moved according to the camera's relationship with the light.  There is a tutorial on this here that at one time I intended to convert to Java3D, but was never able to get it working  - so I'm a fine one to advise anyone else Smiley  - it explains the principles fairly well though, so worth a look.

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #2 - Posted 2003-07-13 19:15:24 »

Thanks for the break down Breakfast.

So I can only have 8 lights? How is that? Is that a Java3D limitation or some other?

I guess that breaks my plan to use lights for lasers and as ship lights... Sad

Tex

EDIT: No I did actually mean PointLight.. Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #3 - Posted 2003-07-13 19:41:54 »

So you basically want a "Glow in the Dark" Object for your
{Hand quote} LASER {hand quote} (ala Austen Powers 2)

Anyways, if you look in the java3d tutorial, you can find how to do it in the 6th chapter  6.7.1

Its a small section that basically says you can use a Material object and set the emissiveColor to the color you want to "glow"

Here is the constructor for Material

Material(Color3f ambientColor,
               Color3f emissiveColor,
               Color3f diffuseColor,
               Color3f specularColor,
               float shininess)

Basic Receipe for Glow In the Dark
------------------------------------------
Create an Appearance Object with the material object.  Then create your geometry with this apperance object.

Here is the link where you can get the tutorial from
http://java.sun.com/products/java-media/3D/collateral/

Thanks for motivating me to look this one up (I needed to do this anyways for my current project)

Ubuntu
Offline Breakfast

Senior Member




for great justice!


« Reply #4 - Posted 2003-07-14 10:40:16 »

I'm not certain about how the 8 lights thing works - someone was saying that it is a maximum on another thread here, but my understanding previous to that was that 8 lights is the most you can have affecting a single polygon. Someone else who knows more than me contradicted that, though, and they are probably right I dont really recall. It derives from OpenGL rather than Java3D, just another of those little restrictions that you need to be aware of.

Although setting the emmissive colour of a shape will make it "glow" in the gameworld (ie it will behave as a light source) it does not have any glow or penumbral effect as far as the viewer is concerned, so it doesn't look like a light source- for that you need a graphic. This is why lasers in games tend to look a little bit flat - because they are.

Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #5 - Posted 2003-07-14 14:50:17 »

Yep, I'd guess the 8 lights thing comes from OpenGL.

A compliant OpenGL driver must support at least eight lights, but may support more.  As the eight is the minimum you can rely on, most OpenGL-using software treats it as the limit.

Hellomynameis Charlie Dobbie.
Offline Breakfast

Senior Member




for great justice!


« Reply #6 - Posted 2003-07-14 19:45:15 »

And that is eight lights total across the entire scene, not eight lights as a maximum that can light a single shape?
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #7 - Posted 2003-07-14 20:03:38 »

Hi
 As I understand it 8 lights is a per render pass limit. Java 3d does multi pass rendering, and can cope with more than eight lights, but only 8 cna effect any surface drawn in that pass. This means that if you have one cube in you scene, and 9 lights, all effecting that one cube, you will get strange effects (maybe only one light effecting the cube), and 1/2 the frame rate as it draws the scene twice. be carefull when using more than 8 lights in your scene. If you look at most games they use techniques like light maps, and (not sure what it's called) fake lights, with lense flare (transparent textured poly with emisive light set). They look convinsing when whizing round space if you get it right Smiley. To do it all with real lights you would need a large number of passes and to get the bounds of you lights spot on so no more than 8 effect any one surface.

HTH

Endolf

Offline Breakfast

Senior Member




for great justice!


« Reply #8 - Posted 2003-07-15 07:02:40 »

Thanks - I've been trying to get my head round that for a while.
Offline misterX

Junior Member




java forever!


« Reply #9 - Posted 2003-07-15 18:41:18 »

What i would try out for the laser:
making the long thin cylinder from here to the end, giving it an emissive color material, making it also half transparant and putting a bit smog all around the laser.
Yep, that should look good!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Breakfast

Senior Member




for great justice!


« Reply #10 - Posted 2003-07-16 07:02:52 »

Smog?
Offline misterX

Junior Member




java forever!


« Reply #11 - Posted 2003-07-16 10:02:10 »

sorry, i meant fog
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #12 - Posted 2003-07-16 10:36:00 »

Volumetric fog in Java3D, that'd be neat. Is it actually possible/been done? I thought most techniques for this needed per pixel access.

Kev

Offline Mark Thornton

Senior Member





« Reply #13 - Posted 2003-07-16 11:00:01 »

How about speckle effects as well for the laser? Without speckle it would just be an ordinary light beam.
Offline Breakfast

Senior Member




for great justice!


« Reply #14 - Posted 2003-07-16 11:35:19 »

Good point- I'm hoping all your lasers will move at the speed of light as well... Smiley
Offline misterX

Junior Member




java forever!


« Reply #15 - Posted 2003-07-16 18:29:30 »

I was wrong with fog, i thought it would act like smoke but not at all, it just makes the background disapear in... fog!
Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #16 - Posted 2003-07-17 02:14:21 »

Hey endolf, it looks like you have some cool lighting effects in Dark Void (green and red lights on one of the ships wings).  Could those be used for phaser beams or are those actual lights?

Ubuntu
Offline bienator

Senior Member




OutOfCoffeeException


« Reply #17 - Posted 2003-07-17 11:01:11 »

Hi all!

I am just wondering why my old Fire*GL* 1 card supports 32 Lights.

bienator

Offline TexMurphy

Senior Newbie




Java games rock!


« Reply #18 - Posted 2003-07-19 09:23:53 »

Thanks for the help guys... Im doing my best working this out...

I got another question about the number of lights... If I have 8 lights in the background geometry and say 8 lights in the sceengraph it self that should be ok right. The light in the background geo will not affect the polygons in the scene right?

Thanks Tex
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #19 - Posted 2003-07-19 09:26:52 »

Yep, lights in the background node don't effect "real" scene nodes.

Kev

Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #20 - Posted 2003-07-19 11:01:46 »

Quote
I am just wondering why my old Fire*GL* 1 card supports 32 Lights.


Supports 32 lights where?  In OpenGL?

The Diamond's FireGL range is/was a professional OpenGL accelerator range, so you'll find they'll be more capable than consumer cards and will provide more functionality than the spec requires.

OpenGL says you need 8 lights minimum, however if the FireGL1 provides 32 lights, great!  More for the developer to play with. Grin

Hellomynameis Charlie Dobbie.
Offline bienator

Senior Member




OutOfCoffeeException


« Reply #21 - Posted 2003-07-21 08:39:17 »

Yes, you have right...

You can include at least eight different light sources in your scene of various colors; the default color of these other lights is black. (The particular implementation of
OpenGL you're using might allow more than eight.)


...from "the red book" Chapter 5

Quote


OpenGL says you need 8 lights minimum, however if the FireGL1 provides 32 lights, great!  More for the developer to play with. Grin


yes but not realy to play with Sad

bienator

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.

Dwinin (21 views)
2014-09-12 09:08:26

Norakomi (55 views)
2014-09-10 13:57:51

TehJavaDev (66 views)
2014-09-10 06:39:09

Tekkerue (33 views)
2014-09-09 02:24:56

mitcheeb (54 views)
2014-09-08 06:06:29

BurntPizza (38 views)
2014-09-07 01:13:42

Longarmx (24 views)
2014-09-07 01:12:14

Longarmx (30 views)
2014-09-07 01:11:22

Longarmx (28 views)
2014-09-07 01:10:19

mitcheeb (37 views)
2014-09-04 23:08:59
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!