Jump to content

Standard Material Diffuse Color Changes


MackeyK24
 Share

Recommended Posts

Does anyone know has there been any recent changes in the 3.x (or even 3.1 alpha) that has changed with the the Standard Material JSON...

I just noticed (because I don't really use a standard material with just a color, always have a texture) but whatever ever color I had in the json, its always white in the scene.

The texture shows up fine... but know diffuse color.... Should the json field be 'diffuse' or 'diffuseColor'...

I can't see whats going on... I know the PBR system went thru major changes and some of the old JSON format like 'overloaderAlbedo' was cause problems and force it to look for the the Legacy PBR Material Library... Is there some the like that with the standard material...

 

Please take a look at my material JSON... should render blue... but shows white:

 

		{
			"customType" : "BABYLON.StandardMaterial",
			"ambient" : [
				0,
				0,
				0,
				1
			],
			"diffuse" : [
				0.14114663,
				0.0446582958,
				0.867647052,
				1
			],
			"specular" : [
				0,
				0,
				0,
				1
			],
			"emissive" : [
				0,
				0,
				0,
				1
			],
			"specularPower" : 128,
			"diffuseTexture" : null,
			"diffuseFresnelParameters" : null,
			"ambientTexture" : null,
			"opacityTexture" : null,
			"opacityFresnelParameters" : null,
			"reflectionTexture" : null,
			"reflectionFresnelParameters" : null,
			"emissiveTexture" : null,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"emissiveFresnelParameters" : null,
			"specularTexture" : null,
			"bumpTexture" : null,
			"useSpecularOverAlpha" : false,
			"disableLighting" : false,
			"useEmissiveAsIllumination" : false,
			"linkEmissiveWithDiffuse" : false,
			"twoSidedLighting" : false,
			"maxSimultaneousLights" : 4,
			"name" : "M_Ground",
			"id" : "f36d005b-1c0e-4ce1-b9e7-5452f6a7efe9",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		},

 

Any help would be awesome :)

 

Link to comment
Share on other sites

I just checked the Babylon Entities... it serializes StandardMaterial color as 'diffuse'

But now... when I use 'diffuse' in json its still white... not parsing diffuse color properly anymore...

but if I just change the JSON to 'diffuseColor' then it works.... Looks like that whole StandardMaterial.diffuseColor using @SerializeAs attribute of 'diffuse' is now having issues... Does anyone have any insight to this issue :)

Yo @Deltakosh or probably @Sebavan ... Any Thoughts :)

 

Link to comment
Share on other sites

I tried again... Here is the scene file I produced using Babylon Entities.... Please try and use this scene file:

Empty.babylon

 

as you can see the material section for 'M_Ground' looks like this:

 

	"materials" : [
		{
			"customType" : "BABYLON.StandardMaterial",
			"ambient" : [
				0,
				0,
				0,
				1
			],
			"diffuse" : [
				0.1882205,
				0.0532006919,
				0.9044118,
				1
			],
			"specular" : [
				0,
				0,
				0,
				1
			],
			"emissive" : [
				0,
				0,
				0,
				1
			],
			"specularPower" : 128,
			"diffuseTexture" : null,
			"diffuseFresnelParameters" : null,
			"ambientTexture" : null,
			"opacityTexture" : null,
			"opacityFresnelParameters" : null,
			"reflectionTexture" : null,
			"reflectionFresnelParameters" : null,
			"emissiveTexture" : null,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"emissiveFresnelParameters" : null,
			"specularTexture" : null,
			"bumpTexture" : null,
			"useSpecularOverAlpha" : false,
			"disableLighting" : false,
			"useEmissiveAsIllumination" : false,
			"linkEmissiveWithDiffuse" : false,
			"twoSidedLighting" : false,
			"maxSimultaneousLights" : 4,
			"name" : "M_Ground",
			"id" : "100ab2ed-67e9-40e2-b991-8c9c012cad6e",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		}

 

But is still white... really strange

 

 

Link to comment
Share on other sites

Now if I change the JSON to diffuseColor instead of diffuse... It works:

 

	"materials" : [
		{
			"customType" : "BABYLON.StandardMaterial",
			"ambientColor" : [
				0,
				0,
				0,
				1
			],
			"diffuseColor" : [
				0.1882205,
				0.0532006919,
				0.9044118,
				1
			],
			"specularColor" : [
				0,
				0,
				0,
				1
			],
			"emissiveColor" : [
				0,
				0,
				0,
				1
			],
			"specularPower" : 128,
			"diffuseTexture" : null,
			"diffuseFresnelParameters" : null,
			"ambientTexture" : null,
			"opacityTexture" : null,
			"opacityFresnelParameters" : null,
			"reflectionTexture" : null,
			"reflectionFresnelParameters" : null,
			"emissiveTexture" : null,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"emissiveFresnelParameters" : null,
			"specularTexture" : null,
			"bumpTexture" : null,
			"useSpecularOverAlpha" : false,
			"disableLighting" : false,
			"useEmissiveAsIllumination" : false,
			"linkEmissiveWithDiffuse" : false,
			"twoSidedLighting" : false,
			"maxSimultaneousLights" : 4,
			"name" : "M_Ground",
			"id" : "100ab2ed-67e9-40e2-b991-8c9c012cad6e",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		}

 

 

Really weird 

 

Link to comment
Share on other sites

16 minutes ago, Deltakosh said:

can you make sure that you are using the latest version?

I just downloaded the latest Babylon.js and Babylon.d.ts

 

Still same thing.... Does the Empty.babylon scene file I sent you work for you...

 

Do you think it could be something in the JSON that is causing a problem like the 'overloadedAlbedo' issue that may exist in a PBR Json will cause to use LegacyPBRMaterial... Maybe something is hanging around in the JSON from the way it worked before.

 

Link to comment
Share on other sites

13 hours ago, Deltakosh said:

can you make sure that you are using the latest version?

Sorry... Did you mean download the latest pre built 'preview release'. ... Which I did :)

OR

Download update to latest GitHub and do a full rebuild (gulp typescript-all) and try that (because you made some fixes that are not in the GitHub preview release folder)

UPDATE: I did this too... Still is white... Its not like 'diffuse' in the JSON... Is That Weird Or What ???

:):):)

 

Link to comment
Share on other sites

I think I found the problem... Was the inclusion of the material library classes... Was about 3 maybe 4 weeks since I updated the material library packages...

If I removed all the material libraries from the page it works... something in the material libraries from a few weeks ago was killing the diffuse color stuff on the standard material... 

Trying the latest Material libraries now :)

 

Link to comment
Share on other sites

Yo @Deltakosh that did the trick... man gotta remember to go back every couple weeks and check those Material Library Packages... :)

 

BTW... Here is a scene shot with the water material library using reflections for the cube and sphere and using a the demo custom particle system with custom shader effect from the docs...

 

All configured right in the editor with absolutely no type of 'startup code' needed to implement:

 

Water Material Config Shot:

598131efa9e8b_ScreenShot2017-08-01at3_55_43PM.thumb.png.3d451da0bb388bc1e1ca9c7efcaeb03f.png

 

Particle System In Editor:

59813245ac587_ScreenShot2017-08-01at4_00_13PM.thumb.png.9da98cd54de2bb761e01655740d5cde5.png

 

Rendered scene example with my diffuse colors also working again:

 

5981326f9fdca_ScreenShot2017-08-01at3_55_20PM.thumb.png.6a2cc19ffb619bf9b6ad72dde8354371.png

 

Whooo... Im glad I found that issue... had me worried something was wrong with the toolkit itself... But not the case... thank god :)

 

Link to comment
Share on other sites

20 hours ago, Deltakosh said:

Man every time you show things like that I want to cry: no one can use it now as they need a small doc to help :)

Dude, I have started and stopped and re-started that DARN documentation several times over and I STILL can't get to look or work right.

1... I don't know the syntax so the formatting is all screwed up

2... I don't know how to reference internal pages I tried [Sample Page](exporters/mysamplepage) but does not work

3... I don't know how to make image show up in page so I can show my snapshots 

I just really suck at that part.

 

Here is an example of my first intro page I'm working on:

 

---
ID_PAGE: 25111
PG_TITLE: Unity
---
## BabylonJS Toolkit

    The BabylonJS Toolkit is designed to provide a small subset of the Unity Editor design time features to export native BabylonJS scene files. You can create your games
    using a design time component based architecture. Please refer to [Unity Editor Documention](https://docs.unity3d.com/Manual/index.html) for details on creating scenes and adding components. The toolkit exports game objects that have a camera, light or mesh component attached. The toolkit also provides built in script components to support native BabylonJS engine features at desgin time. Additional Unity components supported are collider, navigation and animation components only.

    Perspective and orthographic cameras are supported. The 'Allow HDR' camera options can be set to enable the native high dynamic range post processing
    rendering pipeline in your exported scene file. The defautl camera mode will be set to Universal Camera. The Camera Rig component supports detailed camera control
    allowing easy camera type selection and specfic runtime camera mode options.

    The toolkit exports non baked directional, point and spot lights. Realtime lights are standard lights that illuminate the scene at runtime. Baked lights
    are used for lightmap shadow baking at design time. Mixed lights are used to illuminate the scene as well as provided baked lightmap shadows. All realtime
    and mixed lights will be included in the exported scene. All full baked lights will not be included in the exported scene file. This will allow for detailed
    lightmap baking using as many baking lights as required to achieve the best shadow effects as possible without using any of the baking light resources at runtime.
    Please refer to [Unity Editor Documention](https://docs.unity3d.com/Manual/index.html) for details on baking lightmaps and lightmap parameters.

    Skyboxes for the scene are primarily controlled via the Unity Lighting Panel. The scene controller's Skybox Options allow for more detailed settings at runtime.


## Getting Started

    [Project Setup](exporters/00_ProjectSetup): The toolkit requires a project folder for asset file export. A scene controller is also required to support default scene export properties. Default or custom scene controller script components are supported. 


## Toolkit Features
    
    ### 01 Scene Manager

        [Scene Manager](exporters/01_SceneManager): The scene manager application programming interface exposes a Unity like scene component life-cycle. This allows script components to be attached to game objects like meshes, cameras and lights. Each component type has a start, update and destroy function that will get called by the scene manager during it's life cycle.


    ### 02 Scene Contollers

        [Scene Controllers](exporters/02_SceneController): Scene controllers are required to export many of the toolkit scene features. Default scene controller script components can be used for general purposes.

        Creating a custom scene controller allows you to use editor property controls that can be accessed at runtime in client code. Custom scene controllers
        also exposes an execute when ready function that will be called as main entry point for that scene. Global startup scripts are also supported that execute
        on every scene load.

        The editor scripts are C# design-time components used to input game properties for the scene controller. They are not intended to exeute at runtime. They are
        simply to allow the use of design-time properties for your native client scripts. Each editor script specifies the scene's native javascript or typescript backing class to use at runtime.

        The client scripts are your native javascript or typescript classes that actually contain your game logic for the scene. Each scene controller class has a 'ready'
        function that gets called when the scene is ready for execution. Then a 'start' function gets called once during the first frame of the engine game loop, an 'update' function that gets called every frame and a 'destroy' function that get called on component clean up.
    

    ### 03 Script Components

        [Script Components](exporters/03_ScriptComponents): Script components are the primary way of attaching client code to game objects.

        The editor scripts are C# design-time components used to input game properties. They are not intended to exeute at runtime. They are simply to allow the use
        of design-time properties for your native client scripts. Each editor script specifies the native javascript or typescript backing class to use at runtime.

        The client scripts are your native javascript or typescript classes that actually contain your game logic code. Each class has a 'start' function that
        gets called once during the first frame of the engine game loop, an 'update' function that gets called every frame and a 'destroy' function that get called on
        component clean up.


    ### 04 Shader Materials
  
        [Shader Materials](exporters/04_ShaderMaterials): The toollkit supports Unity standard and legacy shaders. Custom Unity shaders are supportted if they follow the Unity shader property naming standard. The universial shader
        material component encapsulates both Unity design time shader and BabylonJS runtime shader information. Please refer to *** Unity Editor Documentation Link *** for details on
        materials and shaders.


    ### 05 Animation State
  
        [Animation State](exporters/05_AnimationState): The toolkit supports simple animation states. Transform animations are used to animate the position, rotation and scale of any light, camera or mesh.
        Skeleton animation are used to animate the bones of a skeletal mesh. Legacy Animation controls are used to enable standard bone key frame animations. 
        Standard Animator controls are used to enable the built-in Unity Mechanim animation rigging.


    ### 06 Collision System
  
        [Collision System](exporters/06_CollisionSystem): The toolkit collision system supports simple collision meshes for each component type (box, sphere, capsule, wheel, mesh and terrain). This allows simple geometry to be be used for physics collisions and mesh intersections instead of the original detailed geometry.


    ### 07 Terrain Builder
  
        [Terrain Builder(exporters/07_TerrainBuilder): Terrain Builder option exports dynamic terrain geometry information to used at runtime. Up to 12 textures and normal maps may be used to paint terrains. Texture atlas maps are created to optimize multiple terrain spat textures. Terrain mesh colliders are supported to optimize runtime collision checking. Colliders can be segmented up to 16 x 16 low poly collision meshes that cover the orginal high poly terrain surface.

        The terrain builder supports custom BabylonJS Toolkit Terrain Splatmap Shaders to allow design time editor access to the terrain render material. If no custom terrain
        splatmap material is selected, default options will be used. Please refer to *** Unity Editor Documentation Link *** for details on custom terrain materials.


    ### 08 Runtime Prefabs

        [Runtime Prefabs(exporters/08_RuntimePrefabs): Runtime prefabs are used to allow client side prefab instantiation. Game objects that are assigned to the Babylon Prefab layer are marked for client side prefab usage and will not be enabled in the scene. The scene manager function 'instantiate prefab' is used to create fully scipted components at runtime. The scene manager uses deep cloning to support skeletal mesh animations and all script components attached to the game object.   


    ### 09 Static Batching

        [Static Batching](exporters/09_StaticBatching): Static batching allow design time mesh combining. Game objects that are assigned to the Babylon Static layer are marker for mesh optimization at scene export. Meshes will automatically be grouped by material and combined and serialized as a single mesh per material. Texture atlas materials are supported to increase multiple texture rendering optimizations.


    ### 10 Navigation Mesh

        [Navigation Mesh](exporters/10_NavigationMesh): Navigation mesh blah blah blah

        See unity documentation [Unity Navigation Mesh](https://docs.unity3d.com/460/Documentation/Manual/Navmeshes.html)


    ### 11 Babylon Art Tools

        [Babylon Art Tools](exporters/11_BabylonArtTools): The toolkit supplies a number of art tools to aid in creating optimized BabylonJS game assets. 


    ### 12 Exporter Windows

        [Exporter Windows](exporters/12_ExporterWindows): The expoerter window is the primary toolkit interface. It must be open to enable the toolkit features during project development. 

        -- Installation
        The plugin folder can be found here: https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/Unity%205/Deprecated
        ** Please note that we are working on a [new version](https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/Unity%205/EditorToolkit) but there is not documentation yet**
        You just need to copy/paste the plugin folder inside the **assets** folder of your project folder. Unity 5 will then detect the plugin, compile it and add a "BabylonJS" menu.
        Using this menu you will be able to export the current scene to a .babylon file format.

        -- Usage
        Just click on the "BabylonJS/Export to .babylon" menu to display the exportation window.

        The exportation window allows you to specify:
        * Default reflection level applied to reflection textures
        * Collisions properties (on/off, ellipsoid used for the camera and scene's gravity)

        You can launch the exportation process by clicking on the "Export" button

        -- Export
        The standard object export feature list include the following:

        * **Cameras**
        * Name
        * Position
        * Target
        * Fov
        * Clip start
        * Clip end
        * Check collisions
        * Gravity
        * Ellipsoid
        * Animations (position)
        * **Lights**
        * Type (Point, directional, Spot)
        * Name
        * Position
        * Direction
        * Spot angle
        * Intensity
        * Diffuse color
        * Animations (position)
        * Shadow maps
        * Light maps
        * **Materials**
        * Name
        * Diffuse color
        * Specular color
        * Specular power
        * Emissive color
        * Alpha
        * Backface culling
        * Diffuse texture
        * Reflection texture
        * Emissive texture
        * Bump texture
        * **Physically based rendering** materials
        * **Multi-materials**
        * Name
        * Child materials
        * **Textures**
        * Name
        * Associated file
        * Use alpha
        * uOffset / voffset
        * uScale / uScale
        * **Meshes**
        * Name
        * Geometry (Positions & normals)
        * Position
        * Rotation
        * Scaling
        * Texture coordinates (2 channels)
        * Check collisions
        * Receive and cast shadows
        * Animations (position, rotation, scaling)
        * Skeletons

 

 

But it looks like this once I grunt build or grunt serve...

 

598307ec9dc70_ScreenShot2017-08-03at1_17_48AM.thumb.png.ae6451b7e498e8577abd2fba80896dc1.png

Link to comment
Share on other sites

4 hours ago, Temechon said:

@MackeyK24 Don't worry about the look of the file, I'll take care of it :D
Just send me the text and I'll do the formatting and PR for you !

Thanks @Temechon  

@Deltakosh helped out some of syntax... Looks WAY Better now...

I broke the features from the docs down into 12 main areas.... Working on the specifics for those 12 main areas now :)

 

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