Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (525)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
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  
  Newbie lighting question  (Read 696 times)
0 Members and 1 Guest are viewing this topic.
Offline nwpappas

Junior Newbie




Java games rock!


« Posted 2004-11-24 18:53:34 »

Hello all.

I just started using Xith3D, while looking for alternatives to Java3D (which, I also just started using along with 3D programming as a whole). Wink  Using the HelloXith3D code as a starting point, I added in a call to New Dawn Software's AC3D loader for a scene I had created earlier in the week.

The scene does load, but it is all dark!  I can see a black outline of everything on a dark-gray background... that's all. Sad

Do I need to add a light source somewhere?  Did I miss something in my code, or in the AC3D file?  All I'm concerned about now is a flood of light -- I don't want any shadows.

Thanks for any help!
Offline rmdire

Junior Devvie





« Reply #1 - Posted 2004-11-25 08:54:39 »

Hi ,

There are a few lighting methods in Xith3D
I tend to use Directional light  but you could also use ambient lighting.

eg.
BranchGroup root = new BranchGroup();
locale.addBranchGraph(root);

   Color3f ambientColor = new Color3f(0.5f, 0.5f, 0.5f);
     AmbientLight ambientLightNode = new AmbientLight(ambientColor);
     root.addChild(ambientLightNode);

or

DirectionalLight   light = new DirectionalLight(true,new Color3f(1f,1f,1f),new Vector3f(0,0,1));
       root.addChild(light);

or you could add something like this to your rendering loop:

lightAngle=lightAngle+0.004;

           Vector3f dir = new Vector3f((float) -Math.cos(lightAngle),(float) Math.cos(3.120),(float) Math.sin(lightAngle));
           light.setDirection(dir);
which would give the impression that the light is moving over your enviornment - like the SUN
play around with the Vector3fs values to see what suits you

hope this helps
cheers

rmdire
Offline rmdire

Junior Devvie





« Reply #2 - Posted 2004-11-25 09:04:26 »

Also - Im not sure if AC3D files provide model specularity etc. Ive never used AC3D.

But for example - if you are using Kevin Glass wonderful
OBJLoader for Loading in your models - the Models material file contains shading and lighting settings.

These can be changed to give the various model parts different shading.

Cheers

rmdire
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nwpappas

Junior Newbie




Java games rock!


« Reply #3 - Posted 2004-11-25 12:30:20 »

Many thanks rmdire.  The AmbientLight works exactly the way I want it to!  I seem to remember not trying that because of the description in my Java3D book... *sigh*  Roll Eyes

I was playing with DirectionalLight, but it caused a change in shading when I moved the scene.  Everything shows up nice and bright now with the AL though. *cheer*

Can you help me understand the values inside the Color3f for the AmbientLight.  I've been playing with them and have them all set to 10 right now, a good value for me during testing at least.  Is there a standard "norm" to these values if I want the images to appear with their natural color and luminance?

Thanks for your help!

Nick
Offline rmdire

Junior Devvie





« Reply #4 - Posted 2004-11-25 13:07:17 »

I'm not sure if there is a standard "norm" for the color3f settings -
but float values in color3f refer to the RGB value of the light.

so if you set the values to color3f(0.1f,0.1f,10.0f)

you would get mostly blue light.

rmdire

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.

toopeicgaming1999 (70 views)
2014-11-26 15:22:04

toopeicgaming1999 (59 views)
2014-11-26 15:20:36

toopeicgaming1999 (14 views)
2014-11-26 15:20:08

SHC (27 views)
2014-11-25 12:00:59

SHC (25 views)
2014-11-25 11:53:45

Norakomi (31 views)
2014-11-25 11:26:43

Gibbo3771 (25 views)
2014-11-24 19:59:16

trollwarrior1 (38 views)
2014-11-22 12:13:56

xFryIx (77 views)
2014-11-13 12:34:49

digdugdiggy (55 views)
2014-11-12 21:11:50
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!