Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 1380 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.

BranchGroup root = new BranchGroup();

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


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

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


           Vector3f dir = new Vector3f((float) -Math.cos(lightAngle),(float) Math.cos(3.120),(float) Math.sin(lightAngle));
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

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.


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!

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.


Pages: [1]
  ignore  |  Print  

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

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

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

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

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

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

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

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

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

Solater (146 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!