Jump to content

Emissive material not rendering


webGLmmk
 Share

Recommended Posts

http://www.babylonjs-playground.com/#LYEU3#0

Been trying to figure this out for hours. I have created constructors for 3 different star types:YellowStar, WhiteStar, and RedStar. I have them pasted in the playground code, but locally, the 3 functions are in a separate file. YellowStars emitting particles do not have the image rendered, which is fine as it doesn't relate to the question. The larger white spheres in the foreground are supposed to be an emissive red color(RedStar objects). The smaller white spheres in the background (WhiteStar objectcs) are white as I intend them to be, but the emissive property isn't working on those either.

It must be a problem with the way I have the constructors written. Because there aren't that many properties in common, I don't have set up to inherit from main Star constructor.  I'd like to have all my objects (including planets eventually), originating from one file.

Often when I have an issue I can't figure out, its usually related to scope.  I dont get whats going on here because the scope of each .mat should be limited within its own function scope. But only the yellow particle emitting spheres have the material working.

 

Quote

var YellowStar = function (position, size, scene) {
    this.sphere = BABYLON.Mesh.CreateSphere("sphere1", 30, 30*size, scene); 
    this.mat = new BABYLON.StandardMaterial("white", scene);
    this.mat.diffuseTexture = new BABYLON.Texture("textures/suntexture.jpg", scene);
    this.mat.specularColor = new BABYLON.Color3(0, 0, 0);
    this.sphere.material = this.mat;
    this.sphere.position = position;

    /*...this material works...*/
};

var WhiteStar = function(position, size, scene){
    this.sphere = BABYLON.Mesh.CreateSphere("whiteStar", 20, 15*size, scene); 
    this.mat = new BABYLON.StandardMaterial("white", scene);
    this.mat.emissiveColor = new BABYLON.Color3(1, 1, 1);
    this.sphere.material = this.mat; /* doesn't work */
}

var RedStar = function (position, size, scene) {
    this.sphere = BABYLON.Mesh.CreateSphere("redStar", 20, 30*size, scene); 
    this.mat = new BABYLON.StandardMaterial("red", scene);
    this.mat.emissiveColor = new BABYLON.Color3(0.714, 0.239, 0.169);
    this.sphere.material = this.mat;  /*doesnt work*/

};

 

 

Link to comment
Share on other sites

Hi @webGLmmk, good to see you again.

   It was a problem with too much light.  I removed those huge airliner lights, and put in some nice mood lighting. RedStar 1 reports all-well, and thanks us for the cooler temperatures on their planet.  :)

http://www.babylonjs-playground.com/#LYEU3#1

Hope this helps.  Party on!

Link to comment
Share on other sites

12 hours ago, Wingnut said:

Hi @webGLmmk, good to see you again.

   It was a problem with too much light.  I removed those huge airliner lights, and put in some nice mood lighting. RedStar 1 reports all-well, and thanks us for the cooler temperatures on their planet.  :)

http://www.babylonjs-playground.com/#LYEU3#1

Hope this helps.  Party on!

The best, once again!  Many thanks

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...