Jump to content

New PBR System Questions


MackeyK24
 Share

Recommended Posts

I see that the whole per system has changed in the 3.0 Beta... A few things I noticed (I know its still in beta, but wanted to point things out)

... First there is no lightmapTexture anymore on the new base pbr, metallic or specular materials... This is a must have for baked shadows... right???

... Maybe its just not that far yet...

and serialization and deserialization is not working at all... when trying to serialize get no serialization function for material error and deserialization just does nothing...

But to work fine creating from code...

Si I guess I'm just letting the big dogs @Deltakosh @Sebavan and @RaananW  know about these few issues so far

Link to comment
Share on other sites

cool, thx for reporting I ll take a look tomorrow.

The 2 new pbr materials match with the gltf definition of pbr in gltf 2.0.

The PbrMaterial still exists on its own as before and should have light map available ? if not definitely a part that went away by mistake.

You can see all the supported feature in the PRBase material which is the parent of the three others.

About Serialization and Deserialization I thought it would be ok but did not has a chance to try.

I ll finish all of it next week if everything happens as plan :-S

 

Link to comment
Share on other sites

On 6/25/2017 at 5:55 PM, Sebavan said:

cool, thx for reporting I ll take a look tomorrow.

The 2 new pbr materials match with the gltf definition of pbr in gltf 2.0.

The PbrMaterial still exists on its own as before and should have light map available ? if not definitely a part that went away by mistake.

You can see all the supported feature in the PRBase material which is the parent of the three others.

About Serialization and Deserialization I thought it would be ok but did not has a chance to try.

I ll finish all of it next week if everything happens as plan :-S

 

Do you plan on putting light map texture into the new pbr base material... if not I would have to make the toolkit use the legacy pbr... I would hope to not have to have the new toolkit using older legacy code for all standard materials in Unity

Link to comment
Share on other sites

4 hours ago, Sebavan said:

It is already in :-)

Well I see the protected _lightmapTexture in the PBR Base class... I id don't see any implementation of it in the PBRBaseSimpleMaterial or the metallic and specular sub class of that either...

 

It seems to me like there should be some kind of:

        @serializeAsTexture()
        @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_lightmapTexture")
        public lightmapTexture: BaseTexture;

 

that is in the PBRBaseSimpleMaterial class to expose that property to the metallic and specular subclasses 

Link to comment
Share on other sites

1 hour ago, Sebavan said:

IT is in from the beginining but wonder why it does not work for you ?

When using the toolkit... Everything is serialized into the seen file, so ALL standard and specular standard materials in unity get serialized into scene and NOTHING

happens when loading the new pbr material using scene loader... If I programmatically create a new PBR and call material.serialze is say cannot find 'serialize' function from 'Serialize' 

Link to comment
Share on other sites

  • 2 weeks later...

Yo @Sebavan ... I packaged up this simple scene file... Should just be a small green plane and a sphere with an amiga texture...

 I am attaching the whole project files:

TestScene.zip

please look at the .babylon file.... this is a sample piece that won't properly de-serialize when loading the scene:

 

"materials" : [
		{
			"diffuseColor" : [
				1,
				1,
				1,
				1
			],
			"diffuseTexture" : {
				"name" : "Amiga.png",
				"level" : 1,
				"hasAlpha" : false,
				"getAlphaFromRGB" : false,
				"coordinatesMode" : 0,
				"isCube" : false,
				"uOffset" : 0,
				"vOffset" : 0,
				"uScale" : 1,
				"vScale" : 1,
				"uAng" : 0,
				"vAng" : 0,
				"wAng" : 0,
				"wrapU" : 1,
				"wrapV" : 1,
				"coordinatesIndex" : 0,
				"isRenderTarget" : false,
				"renderTargetSize" : 0,
				"mirrorPlane" : null,
				"renderList" : null,
				"animations" : null,
				"extensions" : null,
				"samplingMode" : 3
			},
			"specularColor" : [
				0,
				0,
				0,
				1
			],
			"glossiness" : 0.5,
			"specularGlossinessTexture" : null,
			"customType" : "BABYLON.PBRSpecularGlossinessMaterial",
			"maxSimultaneousLights" : 4,
			"disableLighting" : false,
			"environmentTexture" : null,
			"invertNormalMapX" : false,
			"invertNormalMapY" : false,
			"normalTexture" : null,
			"emissive" : [
				0,
				0,
				0,
				1
			],
			"emissiveTexture" : null,
			"occlusionStrength" : 1,
			"occlusionTexture" : null,
			"alphaCutOff" : 0.4,
			"transparencyMode" : 0,
			"doubleSided" : false,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"name" : "M_Cube",
			"id" : "8c3ae44e-7792-4d64-a38b-b50bf10612dc",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		},
		{
			"baseColor" : [
				0.0385917835,
				0.33088237,
				0.0145977456,
				1
			],
			"baseTexture" : null,
			"metallic" : 0,
			"roughness" : 0.5,
			"metallicRoughnessTexture" : null,
			"customType" : "BABYLON.PBRMetallicRoughnessMaterial",
			"maxSimultaneousLights" : 4,
			"disableLighting" : false,
			"environmentTexture" : null,
			"invertNormalMapX" : false,
			"invertNormalMapY" : false,
			"normalTexture" : null,
			"emissive" : [
				0,
				0,
				0,
				1
			],
			"emissiveTexture" : null,
			"occlusionStrength" : 1,
			"occlusionTexture" : null,
			"alphaCutOff" : 0.4,
			"transparencyMode" : 0,
			"doubleSided" : false,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"name" : "M_Ground",
			"id" : "8c80afcb-8087-4b39-a8dd-11b3a82a23e0",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		}
	],

 

This should work for the new PBR system

Link to comment
Share on other sites

4 minutes ago, Sebavan said:

Ok fixed, the serialization name are shared with standardMat, you will need to rename diffuseColor to diffuse and specularColor to specular in the JSON you are generating for the specularGlossinesMaterial.

Will do... What about baseColor for Metallic Workflow... Should that be 'base' or 'baseColor' in JSON...

Also... Are you going to add support for lightmapTexture in per simple base material ???

Link to comment
Share on other sites

nope baseColor is fine (doe not exist somewhere else) but I can rename it if you prefer ?

About lightmap, I would prefer to keep them only in the PBRMaterial which contains all the advance features like refraction and so on to keep the other one simple. I guess you need them for the exporter ? if yes do you rely only on lightmap or lightmap and lightMapasShadowMap ?

 

Link to comment
Share on other sites

4 minutes ago, Sebavan said:

nope baseColor is fine (doe not exist somewhere else) but I can rename it if you prefer ?

About lightmap, I would prefer to keep them only in the PBRMaterial which contains all the advance features like refraction and so on to keep the other one simple. I guess you need them for the exporter ? if yes do you rely only on lightmap or lightmap and lightMapasShadowMap ?

 

I rely on light map as shadow map for the exporter... would hate to have to go legacy PBR just for that.... By the way... how to use the legacy PBR... if I use PBRMaterial... it says I have to to use legacy material library for PBRMaterial... What does that mean???

Link to comment
Share on other sites

Actually Legacy is in the materialsLibrary and only here to keep back compat for ppl who built project upon it. It will be deprecated in 3.1 and not maintain anymore in 3.2.

the PBR system is now composed of 3 Materials:

  • SpecGloss: GlTF like simple implementation
  • MetalRough: GlTF like simple implementation
  • PBRMaterial: Updated version of the already existing one (you could rely upon this one which contains lightmap and should work as before except with correct lighting Maths)

I guess your error comes from the fact you may have some left over properties which have been removed (overloadedAlbedo).

When deserializing we do this check to know if we are deserializing a legacy or new material:

if (parsedMaterial.customType === "BABYLON.PBRMaterial" && parsedMaterial.overloadedAlbedo) {
  parsedMaterial.customType = "BABYLON.LegacyPBRMaterial";
  if (!(<any>BABYLON).LegacyPBRMaterial) {
    BABYLON.Tools.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.");
    return;
  }
}
So if you remove overloadedAlbedo from your json it should load with the new system.
 

 

Link to comment
Share on other sites

  • 1 month later...

@Sebavan,

I removed this from .babylon file.  Now, before excising this property, I had a little, gray beagle that appeared.  But, I also had the LegacyPBRMaterial error, too.  The error is gone and so too is the beagle!  Where did the beagle go?

"overloadedAlbedo" : [
				0,
				0,
				0
			],
			

 

btw, I left this in json:

"overloadedAlbedoIntensity" : 0,

Should this get excised, too?

Thanks, 

Link to comment
Share on other sites

Hi @Sebavan,

I have a .babylon file.  So, I don't see how that works on playground.  But, I have attached the materials portion, assuming this is the problem.

I looked at the .babylon Materials reference here: Babylon Docs - Materials

There's barely any resemblance between the reference and below?!  Is there an integration with Unity?  Did I miss something in the exporter configuration?  How do I map this to the Materials reference?

 

"materials" : [
		{
			"customType" : "BABYLON.PBRMaterial",
			"directIntensity" : 1,
			"emissiveIntensity" : 1,
			"environmentIntensity" : 1,
			"specularIntensity" : 1,
			"cameraExposure" : 1,
			"cameraContrast" : 1,
			"microSurface" : 0,
			"overloadedShadowIntensity" : 1,
			"overloadedShadeIntensity" : 1,
			"overloadedAmbientIntensity" : 0,
			"overloadedAlbedoIntensity" : 0,
			"overloadedReflectivityIntensity" : 0,
			"overloadedEmissiveIntensity" : 0,
			"overloadedAmbient" : [
				0,
				0,
				0
			],
			"overloadedAlbedo" : [
				0,
				0,
				0
			],
			"overloadedReflectivity" : [
				0,
				0,
				0
			],
			"overloadedEmissive" : [
				0,
				0,
				0
			],
			"overloadedReflection" : [
				0,
				0,
				0
			],
			"overloadedMicroSurface" : 0,
			"overloadedMicroSurfaceIntensity" : 0,
			"overloadedReflectionIntensity" : 0,
			"albedoTexture" : {
				"name" : "SimpleBeagleExample1.png",
				"level" : 1,
				"hasAlpha" : false,
				"getAlphaFromRGB" : false,
				"coordinatesMode" : 0,
				"isCube" : false,
				"uOffset" : 0,
				"vOffset" : 0,
				"uScale" : 1,
				"vScale" : 1,
				"uAng" : 0,
				"vAng" : 0,
				"wAng" : 0,
				"wrapU" : 1,
				"wrapV" : 1,
				"coordinatesIndex" : 0,
				"isRenderTarget" : false,
				"renderTargetSize" : 0,
				"mirrorPlane" : null,
				"renderList" : null,
				"animations" : null,
				"extensions" : null
			},
			"ambientTexture" : null,
			"opacityTexture" : null,
			"reflectionTexture" : null,
			"emissiveTexture" : null,
			"reflectivityTexture" : {
				"name" : "SimpleBeagleExample1_MetallicGlossMap.png",
				"level" : 1,
				"hasAlpha" : false,
				"getAlphaFromRGB" : false,
				"coordinatesMode" : 0,
				"isCube" : false,
				"uOffset" : 0,
				"vOffset" : 0,
				"uScale" : 1,
				"vScale" : 1,
				"uAng" : 0,
				"vAng" : 0,
				"wAng" : 0,
				"wrapU" : 1,
				"wrapV" : 1,
				"coordinatesIndex" : 0,
				"isRenderTarget" : false,
				"renderTargetSize" : 0,
				"mirrorPlane" : null,
				"renderList" : null,
				"animations" : null,
				"extensions" : null
			},
			"bumpTexture" : null,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"refractionTexture" : null,
			"ambient" : [
				0,
				0,
				0
			],
			"albedo" : [
				1,
				1,
				1,
				1
			],
			"reflectivity" : [
				0,
				0,
				0
			],
			"reflection" : [
				0,
				0,
				0
			],
			"emissive" : [
				0,
				0,
				0,
				1
			],
			"roughness" : 1,
			"useRoughnessFromMetallicTextureAlpha" : false,
			"useRoughnessFromMetallicTextureGreen" : false,
			"useAlphaFromAlbedoTexture" : false,
			"useEmissiveAsIllumination" : true,
			"useMicroSurfaceFromReflectivityMapAlpha" : true,
			"useSpecularOverAlpha" : true,
			"useRadianceOverAlpha" : true,
			"indexOfRefraction" : 0,
			"invertRefractionY" : false,
			"emissiveFresnelParameters" : null,
			"opacityFresnelParameters" : null,
			"disableLighting" : false,
			"name" : "SimpleBeagle",
			"id" : "611ebefb-3866-4ab5-a7bd-e09a0be1c62b",
			"backFaceCulling" : true,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		}
	]

 

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