create3000 / x_ite

X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.
https://create3000.github.io/x_ite/
Other
67 stars 15 forks source link

background #107

Closed binoclard2005 closed 2 years ago

binoclard2005 commented 2 years ago

Describe the bug

Background { skyColor [0 0 1,.9 .9 1] skyAngle 4.5 }

To Reproduce Steps to reproduce the behavior: in blaxxun contact :
image in x_ite : image

Desktop (please complete the following information):

how make a sky ? Thank :) Marco

create3000 commented 2 years ago

If you only use skyColor/Angle, skyAngle can only be maximum PI (half circle). Your value 4.5 is far away of that. If you use sky and ground the angles can only be PI/2 (quarter circle). A complete reference for Background node can be found here: https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/environmentalEffects.html#Backgrounds.

create3000 commented 2 years ago

Sometimes an image says more than thousand words, here is an example background to study:

DEF Summer Background {
  skyAngle [
    0.8,
    1.3,
    1.4,
    1.5708
  ]
  skyColor [
    0.21 0.31 0.59,
    0.33 0.45 0.7,
    0.57 0.66 0.85,
    0.6 0.73 0.89,
    0.7 0.83 0.98
  ]
  groundAngle [
    0.659972,
    1.2,
    1.39912,
    1.5708
  ]
  groundColor [
    0.105712 0.156051 0.297,
    0.187629 0.255857 0.398,
    0.33604 0.405546 0.542,
    0.3612 0.469145 0.602,
    0.39471 0.522059 0.669
  ]
}
Bildschirmfoto 2022-03-29 um 09 33 05
binoclard2005 commented 2 years ago

ok i use your code but , he is not working ;(

binoclard2005 commented 2 years ago

image

create3000 commented 2 years ago

Note, that the Background must be bound if it is not the first Background in the scene. For this case the Background node has a set_bind field, which must be set to TRUE.

binoclard2005 commented 2 years ago

VRML V2.0 utf8

DEF Summer Background { skyAngle [ 0.8, 1.3, 1.4, 1.5708 ] skyColor [ 0.21 0.31 0.59, 0.33 0.45 0.7, 0.57 0.66 0.85, 0.6 0.73 0.89, 0.7 0.83 0.98 ] groundAngle [ 0.659972, 1.2, 1.39912, 1.5708 ] groundColor [ 0.105712 0.156051 0.297, 0.187629 0.255857 0.398, 0.33604 0.405546 0.542, 0.3612 0.469145 0.602, 0.39471 0.522059 0.669 ] }

NavigationInfo { type "WALK" speed 1 headlight FALSE }

Viewpoint { position 0 1 0 }

remplace par la lumiere du soleil

DirectionalLight{ intensity 1 direction 0 -1 0 }

binoclard2005 commented 2 years ago

this is good ?

create3000 commented 2 years ago

I have tested it and It looks good. Another example of a scene with Background can be found here https://create3000.github.io/media/examples/EnvironmentalEffects/Background/example.html.

binoclard2005 commented 2 years ago

tomorow i test this code :p

create3000 commented 2 years ago

Your Background is in an Inline node, and therefore not bound. You have to bind it per Script, or VisibilitySensor, or ProximitySensor, or you put the Background directly in the file you load.

The load order is as following:

  1. The initial scene is loaded.
  2. The Viewpoint, NavigationInfo, Background is bound.
  3. The Inline nodes are loaded.
create3000 commented 2 years ago

You can directly load every file by using the src attribute, then your Viewpoint, Background, NavigationInfo specified in test_monde.wrlwill be bound on load:

<X3DCanvas src="http://starenda.info/test_monde.wrl"></X3DCanvas>