Jump to content

autoClear and autoClearDepthAndStencil problem


tooyamk
 Share

Recommended Posts

Hello and welcome to the forum.  I've taken the liberty to convert your index.html into what is hopefully am equivalent playground.
https://playground.babylonjs.com/#C72SYZ
Seems to work the same as your example.  I was expecting moving the camera to blur the scene with artifacts.  There is also a preserveDrawingBuffer on the engine options (see engine creation in playground liink).

Link to comment
Share on other sites

Yes, you are right!  I have included code to fix the problem.

The zip download is missing not only a check for createEngine(), but also not exporting the Engine construction parameters the same as the default playground. I would call this is a bug in the Playground zip exporter :)  To see, have a look here and update your index.html
https://github.com/BabylonJS/Babylon.js/blob/master/Playground/js/index.js#L557

ie: create your engine like this:

var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

I did try to explicitly create an engine, but it's not also used by the exporter.  You could overwrite the engine in the playground and export, but better to edit the HTML directly.

 

edit: I think the exported script should look more like this with engine declared after createScene() function:

var engine = (typeof (createEngine === 'function'))
  ? createEngine()
  : new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

var scene = createScene()

Here is the page that creates the engine, so doesn't look too hard to fix.?
https://github.com/BabylonJS/Babylon.js/blob/master/Playground/zipContent/index.html#L45

Link to comment
Share on other sites

41 minutes ago, brianzinn said:

Yes, you are right!  I have included code to fix the problem.

The zip download is missing not only a check for createEngine(), but also not exporting the Engine construction parameters the same as the default playground. I would call this is a bug in the Playground zip exporter :)  To see, have a look here and update your index.html
https://github.com/BabylonJS/Babylon.js/blob/master/Playground/js/index.js#L557

ie: create your engine like this:


var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

I did try to explicitly create an engine, but it's not also used by the exporter.  You could overwrite the engine in the playground and export, but better to edit the HTML directly.

 

edit: I think the exported script should look more like this with engine declared after createScene() function:


var engine = (typeof (createEngine === 'function'))
  ? createEngine()
  : new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

var scene = createScene()

 

perfect!!! thank you

Link to comment
Share on other sites

It worked for me - you are missing the 3rd parameter for Engine constructor:

<script>
  var canvas = document.getElementById("renderCanvas");
  var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
  // ...
</script>

 

Link to comment
Share on other sites

7 minutes ago, brianzinn said:

It worked for me - you are missing the 3rd parameter for Engine constructor:


<script>
  var canvas = document.getElementById("renderCanvas");
  var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
  // ...
</script>

 

Yeah, I  changed the wrong place.Now it's working properly.

Thank you:)

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