KevinBLT Posted January 11, 2016 Share Posted January 11, 2016 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 11, 2016 Share Posted January 11, 2016 @Luuacro will soon be able to answer your question Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted January 12, 2016 Share Posted January 12, 2016 Hey Kevin, I reproduced the bug and fixed it (the pull request was done). For instance, you can replace the line 113 in the TS by ... Line 113 : "if (!this._defines.isEqual(this._cachedDefines) || !this._effect) {" ... Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 12, 2016 Share Posted January 12, 2016 it is now merged :-) Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted January 12, 2016 Author Share Posted January 12, 2016 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. Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted January 12, 2016 Share Posted January 12, 2016 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 Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted January 12, 2016 Share Posted January 12, 2016 You can still play with the Sky material here : http://babylonjs-extras.azurewebsites.net/materialsLibrary/test/ Or the playground example here : http://www.babylonjs-playground.com/#E6OZX#6 Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted January 14, 2016 Author Share Posted January 14, 2016 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? Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted January 20, 2016 Author Share Posted January 20, 2016 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? Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted January 20, 2016 Share Posted January 20, 2016 Oh, just looking for your post (thanks Deltakosh) You should modify the .azimuth property of the material to set the orientation of the sun. Looks like you already modified to inclination Getting the good result by giving the position of the sun is still in my roadmap Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted January 21, 2016 Author Share Posted January 21, 2016 Ah yes. I played and had inclination set to 0 before. Then azimuth only changed the "height". 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.