Update GlossinessPBR

api

(Digitaldraping) #1

Hi, I can update the texture by using the function below. Is it possible to update the GlossinessPBR factor from say 0.3 to 0.9 using the API?
If yes how would you do this?

GlossinessPBR
enable
true
factor
0.3

function apply_the_change(materialToUpdate) {
	my_api.setMaterial( materialToUpdate, function() {
	my_api.updateTexture(
		my_image_url,
		 materialToUpdate.channels.DiffusePBR.texture.uid,
		 function ( err, materialToUpdate ) {
		 }
	 );
} );

(Stephomi) #2

Yes it should work, do you have the full code or something?

The code above is changing the "DiffusePBR" channels, not the GlossinessPBR.


(Digitaldraping) #3

When I try with the code below it does not work.

	function apply_the_change(materialToUpdate) {
		my_api.setMaterial( materialToUpdate, function() {
		    my_api.updateTexture(
		        0.9,
		        materialToUpdate.channels.GlossinessPBR.factor,
		        function ( err, materialToUpdate ) {
		        }
		    )
		});
	}

(Digitaldraping) #4

Okay I have found: https://blog.sketchfab.com/tutorial-sketchfab-api-utility/

This makes it easy. I can now use:

sketchfabAPIUtility.setFactor(“YourMaterialName”, sketchfabAPIUtility.NormalMap, 0.5);

Can someone tell me why something like this: https://blog.sketchfab.com/tutorial-sketchfab-api-utility/ is not baked into the API it seems to make coding so much easier.