Jump to content

[SOLVED] - Latest 2.6 - Another Issue With HDR


MackeyK24
 Share

Recommended Posts

Hey @Deltakosh

The latest 2.6 alpha now gives a BUNCH of error when using HDRCubeTexture:

[.Offscreen-For-WebGL-0x7fc2bf02b800]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

Sorry... Correct it crashes when being deserialized (also with 2.5)

You can download the whole build folder (with the scene file, index page and all textures) at Samples Build Folder

Link to comment
Share on other sites

If i manually create the HDR skybox from code, it works fine... But if the skybox was serialized into the babylon file is crashes with the error listed above.

Note: here is the material in the babylon scene for the skybox:

{
			"customType" : "BABYLON.PBRMaterial",
			"directIntensity" : 1,
			"emissiveIntensity" : 1,
			"environmentIntensity" : 1,
			"specularIntensity" : 1,
			"cameraExposure" : 1.6,
			"cameraContrast" : 0.6,
			"microSurface" : 1,
			"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" : null,
			"ambientTexture" : null,
			"opacityTexture" : null,
			"reflectionTexture" : {
				"customType" : "BABYLON.HDRCubeTexture",
				"size" : 512,
				"useInGammaSpace" : false,
				"generateHarmonics" : true,
				"usePMREMGenerator" : false,
				"isBABYLONPreprocessed" : false,
				"name" : "TesterSkybox.hdr",
				"level" : 1,
				"hasAlpha" : false,
				"getAlphaFromRGB" : false,
				"coordinatesMode" : 5,
				"isCube" : true,
				"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
			},
			"emissiveTexture" : null,
			"reflectivityTexture" : null,
			"bumpTexture" : null,
			"lightmapTexture" : null,
			"useLightmapAsShadowmap" : false,
			"refractionTexture" : null,
			"ambient" : [
				0,
				0,
				0
			],
			"albedo" : [
				0,
				0,
				0
			],
			"reflectivity" : [
				0,
				0,
				0
			],
			"reflection" : [
				0,
				0,
				0
			],
			"emissive" : [
				0,
				0,
				0
			],
			"roughness" : 1,
			"useRoughnessFromMetallicTextureAlpha" : false,
			"useRoughnessFromMetallicTextureGreen" : false,
			"useAlphaFromAlbedoTexture" : false,
			"useEmissiveAsIllumination" : false,
			"useMicroSurfaceFromReflectivityMapAlpha" : false,
			"useSpecularOverAlpha" : false,
			"useRadianceOverAlpha" : false,
			"indexOfRefraction" : 0,
			"invertRefractionY" : false,
			"emissiveFresnelParameters" : null,
			"opacityFresnelParameters" : null,
			"disableLighting" : true,
			"name" : "sceneHdrSkyboxMaterial",
			"id" : "b65d7388-21d4-4466-8e80-df3df2023cf2",
			"backFaceCulling" : false,
			"wireframe" : false,
			"alpha" : 1,
			"alphaMode" : 2
		}

 

Link to comment
Share on other sites

11 hours ago, Sebavan said:

PR is here: https://github.com/BabylonJS/Babylon.js/pull/1681

But you also need to not set roughness and metallic in you exporter for the .babylon file cause if it is present you end up in metallic workflow instead of spec gloss for the skybox.

 

Thanks @Sebavan ... You saved the day for my toolkit ... again :)

So what for SKYBOX material set roughness to 0 and MAKE SURE To NOT use specular material info ???

This is how i make Skybox material in unity C#...

 

BabylonMaterial useSkyboxMaterial = null;
if (ishdr)
{
    var skyboxMaterial = new BabylonPBRMaterial()
    {
        name = "sceneSkyboxMaterial",
        id = Guid.NewGuid().ToString(),
        microSurface = (SceneController != null) ? SceneController.lightingOptions.skyboxSurface : 1.0f,
        cameraContrast = (SceneController != null) ? SceneController.lightingOptions.skyboxContrast : 0.6f,
        cameraExposure = (SceneController != null) ? SceneController.lightingOptions.skyboxExposure : 1.6f,
    };
    skyboxMaterial.roughness = 0;
    skyboxMaterial.reflectionTexture = skytex;
    skyboxMaterial.backFaceCulling = false;
    skyboxMaterial.disableLighting = true;
    skybox.materialId = skyboxMaterial.id;
    useSkyboxMaterial = skyboxMaterial;
}
else
{
    var skyboxMaterial = new BabylonStandardMaterial()
    {
        name = "sceneSkyboxMaterial",
        id = Guid.NewGuid().ToString(),
        diffuse = Color.black.ToFloat(),
        specular = Color.black.ToFloat()
    };
    skyboxMaterial.reflectionTexture = skytex;
    skyboxMaterial.backFaceCulling = false;
    skyboxMaterial.disableLighting = true;
    skybox.materialId = skyboxMaterial.id;
    useSkyboxMaterial = skyboxMaterial;
}
babylonScene.MeshesList.Add(skybox);
babylonScene.MaterialsList.Add(useSkyboxMaterial);
babylonScene.AddTextureCube("sceneSkyboxMaterial");

Is this not right for skybox (especially the ishdr section) ???

Link to comment
Share on other sites

Yo @Sebavan can you please take a look at the Test Skybox Project again.

 

WEB GL errors are gone but the skybox still shows nothing... Now regular 6-sided skybox using BABYLON.CubeTexture work just fine during deserialization and they are made with a standard material.

I don't get it... I can set a skybox using client code on a PBR material using

metallic  = 0

roughness = 0

microSurface = 1

cameraContrast = 0.6

cameraExposure 1.6

backFaceCulling = false;

disableLighting = true;

Works great from code like this:

var hdrDefaultTexturePath =  this.getProperty('hdrDefaultTexturePath',"/Scenes/TesterSkybox.hdr");           
var hdrTexture = new BABYLON.HDRCubeTexture( hdrDefaultTexturePath, this.scene, 512);

var  boxSize =  this.getProperty('boxSize', 1000);  
var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox",boxSize, this.scene);
var hdrSkyboxMaterial = new BABYLON.PBRMaterial("skyBox", this.scene);
hdrSkyboxMaterial.backFaceCulling = this.getProperty('backFaceCulling',false);
hdrSkyboxMaterial.reflectionTexture = hdrTexture;
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
hdrSkyboxMaterial.roughness = 0;
hdrSkyboxMaterial.metallic = 0;
hdrSkyboxMaterial.microSurface = this.getProperty('microSurface',1.0);
hdrSkyboxMaterial.cameraExposure = this.getProperty('cameraExposure',0.6);
hdrSkyboxMaterial.cameraContrast = this.getProperty('cameraContrast',1.6);
hdrSkyboxMaterial.disableLighting = this.getProperty('disableLighting',true);
hdrSkybox.material = hdrSkyboxMaterial;
hdrSkybox.infiniteDistance = this.getProperty('hdrSkyboxInfiniteDistance',true);

But if i serialize the same exact info into the scene using C#:

var skyboxMaterial = new BabylonPBRMaterial()
{
    name = "sceneSkyboxMaterial",
    id = Guid.NewGuid().ToString(),
    microSurface = (SceneController != null) ? SceneController.lightingOptions.skyboxSurface : 1.0f,
    cameraContrast = (SceneController != null) ? SceneController.lightingOptions.skyboxContrast : 0.6f,
    cameraExposure = (SceneController != null) ? SceneController.lightingOptions.skyboxExposure : 1.6f,
};
skyboxMaterial.metallic = 0;
skyboxMaterial.roughness = 0;
skyboxMaterial.reflectionTexture = skytex;
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.disableLighting = true;
skybox.materialId = skyboxMaterial.id;
useSkyboxMaterial = skyboxMaterial;

Which should do the same thing as far as the babylon scene file is concerned. But for some reason its not showing anything in skybox... Please download and pop the test skybox scene on your web server and check it out. We must be still missing during deserialization... OR I AM DOING SOMETHING WRONG :(

 

Link to comment
Share on other sites

HOLYSHIT BATMAN... I think i found the problem.

First of all the original exporter DID NOT support HDR skyboxes (it would split out HDR to 6 sided jpeg or png and use that as skybox). I added HDRCubeTexture based of working code for CubeTexture. The way the system worked, if you had a skybox... it would Dump that texture and use that same exact texture for the actual skybox material reflection texture (in SKYBOX mode) as well as EVERY OTHER PBR MATERIAL in the scene would also get that same exact reflection texture. This worked fine for CubeTexture. BUT DOES NOT WORK FOR HDRCubeTexture. The reason is that the HDR reflection texture that is assign to the skybox material CANNOT be used on any other PBR materials. Now we could simple rename reflection textures on the C# side but this will lead the reflection textures (especially 6 sided) to load across the wire again... This really sucks when already loading a LRAGDE HDR across the wire the first time...

 

So i had to re-architect how Skybox Reflections work in general (For both CubeTexture with Standard materials and HDRCubeTexture with PBR materials).

 

Basically i call DumpSkyboxReflectionTexture ONCE in SceneBuilder.cs (as apposed to every material in DumpPBRMaterial)... This dumps the texture and puts in scene folder... Then i create the skybox like normal specifying the SKYBOX reflectionTexture... But I DO NOT assign that reflectionTexture to every other PBR material (Not yet at least). But instead serialize a little metadata on the scene with the skybox material id...

 

Then Scene manager will parse this Skybox reflection texture and CLONE is as ONE GLOBAL SkyboxReflectionTexture ... we then loop thru all PBR materials in the scene and assign the reflectionTexture... So far is Working GREAT... and a bit faster too... Still takes to load the VERY LAGE HDR... but faster than it did before: Here is a Scene Manager Reflection Texture Client side parsing code:

 

// Parse skybox reflection textures
if (this._scene.metadata.properties.isHighDynamicRange && this._scene.metadata.properties.useReflectionLevel && this._scene.metadata.properties.useSkyboxReflections && this._scene.metadata.properties.sceneSkyboxMaterialId) {
    var isHighDynamicRange:boolean = this._scene.metadata.properties.isHighDynamicRange;
    var useSkyboxReflections:boolean = this._scene.metadata.properties.useSkyboxReflections;
    var useReflectionLevel:number = this._scene.metadata.properties.useReflectionLevel;
    var sceneSkyboxMaterialId:string = this._scene.metadata.properties.sceneSkyboxMaterialId;
    if (useSkyboxReflections === true && sceneSkyboxMaterialId != null && sceneSkyboxMaterialId !== "") {
        var skyboxMaterial:BABYLON.Material = this._scene.getMaterialByID(sceneSkyboxMaterialId);
        if (skyboxMaterial != null && (<any>skyboxMaterial).reflectionTexture) {
            if (isHighDynamicRange) {
                var hdrSkyboxReflection:BABYLON.HDRCubeTexture = (<any>skyboxMaterial).reflectionTexture;
                BABYLON.SceneManager.skyboxReflection = hdrSkyboxReflection.clone();
            } else {
                var ldrSkyboxReflection:BABYLON.CubeTexture = (<any>skyboxMaterial).reflectionTexture;
                BABYLON.SceneManager.skyboxReflection = ldrSkyboxReflection.clone();
            }
        }
        if (BABYLON.SceneManager.skyboxReflection != null) {
            BABYLON.SceneManager.skyboxReflection.level = useReflectionLevel;
            this._scene.materials.forEach((material) => {
                if (material instanceof BABYLON.PBRMaterial) {
                    var pbr:BABYLON.PBRMaterial = material as BABYLON.PBRMaterial;
                    if (pbr.id !== sceneSkyboxMaterialId) {
                        pbr.reflectionTexture = BABYLON.SceneManager.skyboxReflection;
                        console.log("===> Set reflection texture pbr: " + pbr.name + " ---> level: " + pbr.reflectionTexture.level);
                    }
                }
            });
        }
    }
}

Again... Working great so far... unless you see something wrong with this approach ...

So please.. take a look again... 

Yo @Sebavan can you please take a look at the Test Skybox Project (FIXED) again.

 

Yo @MrVR we almost there bro :)

 

Link to comment
Share on other sites

Well ill be dammed... The HDRCubeTexture.clone() causes ANOTHER download of the .hdr file across the wire... Is it supposed to do that... If that is the case... I could just save reflection textures with a different filename and NOT have to assign reflectionTexture at the client level... It would LOAD the skybox texture TWICE i guess... That kinda sucks for the wire :(

Yo @Sebavan or @Deltakosh What do you think i should do about this ???

 

Link to comment
Share on other sites

40 minutes ago, MackeyK24 said:

HOLYSHIT BATMAN... I think i found the problem.

First of all the original exporter DID NOT support HDR skyboxes (it would split out HDR to 6 sided jpeg or png and use that as skybox). I added HDRCubeTexture based of working code for CubeTexture. The way the system worked, if you had a skybox... it would Dump that texture and use that same exact texture for the actual skybox material reflection texture (in SKYBOX mode) as well as EVERY OTHER PBR MATERIAL in the scene would also get that same exact reflection texture. This worked fine for CubeTexture. BUT DOES NOT WORK FOR HDRCubeTexture. The reason is that the HDR reflection texture that is assign to the skybox material CANNOT be used on any other PBR materials. Now we could simple rename reflection textures on the C# side but this will lead the reflection textures (especially 6 sided) to load across the wire again... This really sucks when already loading a LRAGDE HDR across the wire the first time...

 

So i had to re-architect how Skybox Reflections work in general (For both CubeTexture with Standard materials and HDRCubeTexture with PBR materials).

 

Basically i call DumpSkyboxReflectionTexture ONCE in SceneBuilder.cs (as apposed to every material in DumpPBRMaterial)... This dumps the texture and puts in scene folder... Then i create the skybox like normal specifying the SKYBOX reflectionTexture... But I DO NOT assign that reflectionTexture to every other PBR material (Not yet at least). But instead serialize a little metadata on the scene with the skybox material id...

 

Then Scene manager will parse this Skybox reflection texture and CLONE is as ONE GLOBAL SkyboxReflectionTexture ... we then loop thru all PBR materials in the scene and assign the reflectionTexture... So far is Working GREAT... and a bit faster too... Still takes to load the VERY LAGE HDR... but faster than it did before: Here is a Scene Manager Reflection Texture Client side parsing code:

 


// Parse skybox reflection textures
if (this._scene.metadata.properties.isHighDynamicRange && this._scene.metadata.properties.useReflectionLevel && this._scene.metadata.properties.useSkyboxReflections && this._scene.metadata.properties.sceneSkyboxMaterialId) {
    var isHighDynamicRange:boolean = this._scene.metadata.properties.isHighDynamicRange;
    var useSkyboxReflections:boolean = this._scene.metadata.properties.useSkyboxReflections;
    var useReflectionLevel:number = this._scene.metadata.properties.useReflectionLevel;
    var sceneSkyboxMaterialId:string = this._scene.metadata.properties.sceneSkyboxMaterialId;
    if (useSkyboxReflections === true && sceneSkyboxMaterialId != null && sceneSkyboxMaterialId !== "") {
        var skyboxMaterial:BABYLON.Material = this._scene.getMaterialByID(sceneSkyboxMaterialId);
        if (skyboxMaterial != null && (<any>skyboxMaterial).reflectionTexture) {
            if (isHighDynamicRange) {
                var hdrSkyboxReflection:BABYLON.HDRCubeTexture = (<any>skyboxMaterial).reflectionTexture;
                BABYLON.SceneManager.skyboxReflection = hdrSkyboxReflection.clone();
            } else {
                var ldrSkyboxReflection:BABYLON.CubeTexture = (<any>skyboxMaterial).reflectionTexture;
                BABYLON.SceneManager.skyboxReflection = ldrSkyboxReflection.clone();
            }
        }
        if (BABYLON.SceneManager.skyboxReflection != null) {
            BABYLON.SceneManager.skyboxReflection.level = useReflectionLevel;
            this._scene.materials.forEach((material) => {
                if (material instanceof BABYLON.PBRMaterial) {
                    var pbr:BABYLON.PBRMaterial = material as BABYLON.PBRMaterial;
                    if (pbr.id !== sceneSkyboxMaterialId) {
                        pbr.reflectionTexture = BABYLON.SceneManager.skyboxReflection;
                        console.log("===> Set reflection texture pbr: " + pbr.name + " ---> level: " + pbr.reflectionTexture.level);
                    }
                }
            });
        }
    }
}

Again... Working great so far... unless you see something wrong with this approach ...

So please.. take a look again... 

Yo @Sebavan can you please take a look at the Test Skybox Project (FIXED) again.

 

Yo @MrVR we almost there bro :)

 

Hey @MackeyK24 Im reading and if I understand well, you will be able to setup an hdr sky reflection texture individually on the PBR material not matter if the skybox is setup , hdr, or regular?, thats why on my script for the hdrskybox is separate from the PBR material so I can chose my own HDR texture or by default the current skybox if it is HDR

- I'm currently working PARTICLES systems, (let me know if you need me for the PBR), I want to predefined some laser, bubbles, starts. etc effects if you now sample code or library I can use please let me know otherwise I keep doing as try and error to see what I get. I have many questions about this we should get a separate tread for Particles Systems 

Link to comment
Share on other sites

Quote

irst of all the original exporter DID NOT support HDR skyboxes (it would split out HDR to 6 sided jpeg or png and use that as skybox). I added HDRCubeTexture based of working code for CubeTexture. The way the system worked, if you had a skybox... it would Dump that texture and use that same exact texture for the actual skybox material reflection texture (in SKYBOX mode) as well as EVERY OTHER PBR MATERIAL in the scene would also get that same exact reflection texture. This worked fine for CubeTexture. BUT DOES NOT WORK FOR HDRCubeTexture. The reason is that the HDR reflection texture that is assign to the skybox material CANNOT be used on any other PBR materials. Now we could simple rename reflection textures on the C# side but this will lead the reflection textures (especially 6 sided) to load across the wire again... This really sucks when already loading a LRAGDE HDR across the wire the first time...

@MackeyK24 I think we should make also the reflection HDR texture optional per material because the reflections map combine with the  reflectivityTexture, albedoTexture is what it makes the power to create multiple materials I dont know if a normal texture is available for PBR but that it would be amazing to have with a range input to scale the BUMPINESS on the normal texture for PBR 

NO BUMPINESS MAPnoBump.JPG NEGATIVE BUMPINESS -150%negativeBump.JPGBUMPINESS MAP 100%positiveBump.JPG

ALSO Can you please add this options REGULAR PBR we can turn on the border (GLOW), the WIRE-FRAME on and the last one I increase the fresnel and I get a better wireframe etc... I have more option in review.. What do you think @MackeyK24

PBRball.JPGPBRGlow.JPGPBRWired.JPGPBRWireFresnel.JPG

HERE is the sample of many combinations of HDR, wire, and different textures 

wireTexture.JPG

Link to comment
Share on other sites

Hey @MrVR ... First off... Nice job :)

 

The material ALREADY have an options (that will be added to babylon shaders):

// Skybox Reflection
bool disableSkyboxReflection = false;
if (material.HasProperty("_DisableSkyboxReflection"))
{
    disableSkyboxReflection = (material.GetInt("_DisableSkyboxReflection") != 0);
}
babylonPbrMaterial.reflectionTexture = (disableSkyboxReflection == false) ? DumpSkyboxReflectionTexture() : null;

 

This is n the DumpPBRMaterial... So i will be adding _DisableSkyboxReflection to the BabylonShaderInterface.cs to support Material Inpector Properties for PBR material shaders.

 

I made a Toolkit 1.0.1 Material Inspector and the native High Dynamic Range Supported that should clarify things (I HOPE :))

 

U3D - BabylonJS: Material Inspector and the native High Dynamic Range Support

 

Yo @Sebavan and @Deltakosh and @ragingclaw and @Wingnut and anyone else interested in HDR Babylon Toolkit HDR support. Check out the video link above :)

 

Link to comment
Share on other sites

Hey @MackeyK24 Nice work on the HDR sky box, Just a few things to point out

1. On the Main Camera, You have the HDR check box, Is this to activate or deactivate the HDR sky-box, and to change the HDR properties (Exposure Luminance etc).

2. then on the scene-controller you have the SKY BOX texture, and in the \

3. Light/Scene you have the   HDR MAP and the REFLECTION MAP

- Why we dont put it all in the Scene controller because is confusing setting it up in all these three different places dont you think.is it possible?

 

About the PBR materials I totally get what your saying to make them serialized when exporting the metadata, Don't worry I will take care of that, I will  re-watch the video again tonight and I will let you know If I need your help, but I think we need to talk and agree in some stuff for example.

I think your going this way, If I put the PBR options from my script on the PBR materials then I will use the PBR material Shader options to create exportable PBR materials , Instead of pre-setting values in code for metal, wire, glass, wood etc, so in this way we can share a material library with real material and no code to create them.

I want to finish the materials workflow, and I will do the same for the particle system, I need a way to create multiple particles but I want some presets to have an start point, e.g (laser beans, starts , light saber, bubbles, fire, smoke etc  )  tif you have any nice particles done please share the parameter with me thanks.

DO YOU KNOW if I can use video clips as texture on an empty game Object for example this video for a video texture https://drive.google.com/open?id=0B6S-ywLEQkbnZWp5eHNQbW9GR0k I will look into video textures material and see

infoGraphics.JPG

 

 

Link to comment
Share on other sites

6 hours ago, MrVR said:

 

Hey @MackeyK24 Nice work on the HDR sky box, Just a few things to point out

1. On the Main Camera, You have the HDR check box, Is this to activate or deactivate the HDR sky-box, and to change the HDR properties (Exposure Luminance etc).

2. then on the scene-controller you have the SKY BOX texture, and in the \

3. Light/Scene you have the   HDR MAP and the REFLECTION MAP

- Why we dont put it all in the Scene controller because is confusing setting it up in all these three different places dont you think.is it possible?

 

1... The HDR settings on the Camera is t active a HDRRendingPipeline (a post process) and the camera rig contains the HDR camera settings

2... The Scene controller is where ANY settings the are NOT the unity standard settings (you CANNOT add properties to an existing unity inspector panel)

3... Light/Scene is here in UNITY you set the skybox material and any other default unity settings...

So the Camera HDR it total separate HDR technology then the use usage of a .HDR file (used as cubemaps)

So what i show in the video was 3 different types of usage of HDR tech.

1... Camera High dynamic range pipeline (BABYLON.HDRRenderingPipeline)

2... Native HDR Skybox (using 1 single HDR cubemap)

3... Usage of a stand alone cubemap (to use however you want)

 

Link to comment
Share on other sites

@MrVR Nice one :-)

@MackeyK24 I checked your scene and the issue is your material (the skybox one in the file) is having the reflectivity to 0 so not reflective at all so not showing the skybox, it does not happen on the global one cause you create a new mat and the default value is 1,1,1 in the pbr mat:

        /**
         * AKA Specular Color in other nomenclature.
         */
        @serializeAsColor3("reflectivity")
        public reflectivityColor = new Color3(1, 1, 1);

So if you replace, line 5600 of your .babylon by "reflectivity" : [
                1,
                1,
                1
            ],

it will all work without the global HACK.

Link to comment
Share on other sites

5 hours ago, Sebavan said:

@MrVR Nice one :-)

@MackeyK24 I checked your scene and the issue is your material (the skybox one in the file) is having the reflectivity to 0 so not reflective at all so not showing the skybox, it does not happen on the global one cause you create a new mat and the default value is 1,1,1 in the pbr mat:

        /**
         * AKA Specular Color in other nomenclature.
         */
        @serializeAsColor3("reflectivity")
        public reflectivityColor = new Color3(1, 1, 1);

So if you replace, line 5600 of your .babylon by "reflectivity" : [
                1,
                1,
                1
            ],

it will all work without the global HACK.

Yo @Sebavan that worked as far as reflectivity ... but i am still running into an issue when using HDRCubeTexture for each scene material that i set reflectionTexture to is cause the .hdr to load again in the browser... Ever heard that one... I will upload a sample doing that in a few

 

Link to comment
Share on other sites

Guys I think I'm working all over the place so,

-I'm going to be working integrating natively on unity all the new stuff for PBR materials.

I have a bunch of new options to create stunning PBR materials that I have to test

Then we can create real exportable material libraries like  @MackeyK24 suggested

 

-I want to create something similar as the PBR shader for the particles system and the solid particle system (SPS to break glass ,walls etc physics effects ).

It take me long time to design any particle because I have to play moving the values for the particles and deploy it to see how it looks like, moreover, I think we should create something we can modify a run time or

Is there a way or a particle creator software, (besides the playground), I can use to do my particles?? other wise I suggest let create one native for Unity.

 

- I think @mackey24 already work on the camera rig controls and the sky box I'm waiting for the code to be finish to test this features,  Hey Mackey please dont forget to put the VR camera I'm anxious to tested  je je 

Link to comment
Share on other sites

1 hour ago, MrVR said:

@MackeyK24 IM getting stock I will look into this tomorrow 

pbr.PNG

 

First of all... you got TOOOOO many parameters on there... Things like albedoTexture are already part of the default PBR material... So no need to use another albedoTexture that is overriding was the actual scene is using... Jus look at the EXISTING DumpPBRMaterial function... You are ONLY trying to add a few additional patermaters that will be useful to set right in the material inspector instead of in code... and things that are already NOT BEGING USED... so you be doing stuff like cameraContast and maybe the overload stuff... But DONT OVERWRITE ANY EXISTING stuff...

Cand second you one of code that are giving you red errors line are simply syntax errors... You are trying to get the value from the material for EVERYTHING as an int ... material.GetInt should only used to get integer values... You have to look at 'Material Inspector Properties' in unity to get a handle on how material properties work... Just take at look at existing code and i handle different types :)

 

Link to comment
Share on other sites

@Sebavan @MackeyK24

9 hours ago, MackeyK24 said:

 

First of all... you got TOOOOO many parameters on there... Things like albedoTexture are already part of the default PBR material... So no need to use another albedoTexture that is overriding was the actual scene is using... Jus look at the EXISTING DumpPBRMaterial function... You are ONLY trying to add a few additional patermaters that will be useful to set right in the material inspector instead of in code... and things that are already NOT BEGING USED... so you be doing stuff like cameraContast and maybe the overload stuff... But DONT OVERWRITE ANY EXISTING stuff...

Cand second you one of code that are giving you red errors line are simply syntax errors... You are trying to get the value from the material for EVERYTHING as an int ... material.GetInt should only used to get integer values... You have to look at 'Material Inspector Properties' in unity to get a handle on how material properties work... Just take at look at existing code and i handle different types :)

 

Ok I see what your saying I can see there is an entity for the material already that dont have all the properties I want to implement, so

 babylonPbrMaterial.reflectionTexture = DumpTextureFromMaterial(material,"_ReflectionTexture");
                if (babylonPbrMaterial.reflectionTexture != null && material.HasProperty("reflectionTexture"))
                    {          
                               var texture =  babylonPbrMaterial.reflectionTexture;

                    }

BUT when I do it in babylon java-script I do 

 this.hdrTexture  = new BABYLON.HDRCubeTexture(this.getProperty('hdrTexturePath',''), this.scene, 512);
            var custom = new BABYLON.PBRMaterial('custom', this.scene);
                    custom.reflectionTexture = this.hdrTexture;
                    

So if I get in the C# code the HDR texture what do I do here to map the HDR texture or Cube map texture to create  this.hdrTexture?

 so I can set the babylonPbrMaterial.reflectionTexture =  hdrTexture; from the HDR or CUBE texture in C# or how this would work ocoming from C# to Javascript or TS

 

--- UPDATE

Ok I see where the reflection map is done never mind

  babylonPbrMaterial.reflectionTexture = DumpReflectionTexture();

Link to comment
Share on other sites

11 hours ago, MrVR said:

@Sebavan @MackeyK24

Ok I see what your saying I can see there is an entity for the material already that dont have all the properties I want to implement, so


 babylonPbrMaterial.reflectionTexture = DumpTextureFromMaterial(material,"_ReflectionTexture");
                if (babylonPbrMaterial.reflectionTexture != null && material.HasProperty("reflectionTexture"))
                    {          
                               var texture =  babylonPbrMaterial.reflectionTexture;

                    }

BUT when I do it in babylon java-script I do 


 this.hdrTexture  = new BABYLON.HDRCubeTexture(this.getProperty('hdrTexturePath',''), this.scene, 512);
            var custom = new BABYLON.PBRMaterial('custom', this.scene);
                    custom.reflectionTexture = this.hdrTexture;
                    

So if I get in the C# code the HDR texture what do I do here to map the HDR texture or Cube map texture to create  this.hdrTexture?

 so I can set the babylonPbrMaterial.reflectionTexture =  hdrTexture; from the HDR or CUBE texture in C# or how this would work ocoming from C# to Javascript or TS

 

--- UPDATE

Ok I see where the reflection map is done never mind

  babylonPbrMaterial.reflectionTexture = DumpReflectionTexture();

Yep... Handle automatically for EVERY Unity Standard Material (Note the Babylon PBR Material is subclass of Unity Standard Material With a few babylon specific properties added on) in the scene... So you don't need to 'explicitly' set the reflectionTexture to a HDRCubeTexture for every game object ion the scene using PBR materials in babylon... Even if you just have the standard unity shaders (including the specular one). Also note that if you use the pbr material you can however go and explicitly 'disable skybox reflection' on a game object material if you need to or don't want that object to reflect the skybox.

 

Link to comment
Share on other sites

  • 3 weeks later...

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