Jump to content

Skymaterial from material library is broken for me


KevinBLT
 Share

Recommended Posts

Hello everyone,

 

I hope you had great holidays!

 

I am back at work now and found these new materials very interesting.

While implementing the new "sky material", I encountered the following error:

 

File: /dist/babylon.skyMaterial.js

        this._effect = scene.getEngine().createEffect(shaderName, attribs, ["world", "viewProjection",                    "vFogInfos", "vFogColor", "pointSize", "vClipPlane",                    "luminance", "turbidity", "rayleigh", "mieCoefficient", "mieDirectionalG", "sunPosition"                ], [], join, fallbacks, this.onCompiled, this.onError);            }            if (!this._effect.isReady()) { // <=== this._effect is null, therefore error "isReady of null"                return false;            }            this._renderId = scene.getRenderId();            this._wasPreviouslyReady = true;

this._effect.isReady() throws an error because this._effect is null.

 

What's the problem here?

 

Thanks

 

Kevin

Link to comment
Share on other sites

I thank you guys a lot! It's working now and looks really nice.

I have some problems with the usability:

Is there really no way to set the "sun's" position? Even rotating the box doesn't work, so I am not able to match the sun on the texture with the real directional light I am already using in this project. What could I do? There is an internal "_sunPosition" in the skymaterial, but it's not changeable from the outside.

Link to comment
Share on other sites

I see what you mean, I'll add a function that returns the potential position of the sun according to a given position (BABYLON.Vector3)

The material doesn't work on the nodes transformations, but only on pixels visible, you'll not be able to animate the sky by moving or rotating the box. For instance, just use the .inclination and .azimuth properties. I come back sure when I have implemented the function :) 

Link to comment
Share on other sites

Thanks. I was able to set it to the right values with this.

But now the sun is in the west for me. I really need it in the south. I cannot rotate everything else - would be a lot more work (scene is real time constructed out of parameters).

Is it impossible to attach it to the box rotation anyhow?

View1.jpg

Link to comment
Share on other sites

Quote

But now the sun is in the west for me. I really need it in the south. I cannot rotate everything else - would be a lot more work (scene is real time constructed out of parameters).

Is it impossible to attach it to the box rotation anyhow

Nothing possible with this?

Link to comment
Share on other sites

Ah yes.

I played and had inclination set to 0 before. Then  azimuth only changed the "height". :D

I've played again and it's perfect now. :)

I thank you a lot! It's better than every skytexture I could imagine. 

Do you think there will come something like a "cloud generator" also? :rolleyes:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...