Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutputPass inpostprocessing. render error #28981

Closed
zhaocaho opened this issue Jul 26, 2024 · 1 comment
Closed

OutputPass inpostprocessing. render error #28981

zhaocaho opened this issue Jul 26, 2024 · 1 comment
Milestone

Comments

@zhaocaho
Copy link
Contributor

zhaocaho commented Jul 26, 2024

Description

Added a MeshPhysicalMaterial cube, set transparent=true,opacity=0.3.

Reproduction steps

1.render error

Code

<script type="module">
			import * as THREE from 'three';

			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
			import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
			import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
			import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
			import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

			const params = {
				add_RenderPass_OutputPass: true
			};


			let gui;
			let camera, scene, renderer;
			let composer;

			init();

			function init() {

				const container = document.createElement( 'div' );
				document.body.appendChild( container );

				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.25, 20 );
				camera.position.set( - 1.8, 0.6, 2.7 );

				scene = new THREE.Scene();

				new RGBELoader()
					.setPath( 'textures/equirectangular/' )
					.load( 'royal_esplanade_1k.hdr', function ( texture ) {

						texture.mapping = THREE.EquirectangularReflectionMapping;

						scene.background = texture;
			
		} );
				const ambientLight = new THREE.AmbientLight( 0xffffff, 1 );
				scene.add( ambientLight );
			
				const geometry = new THREE.BoxGeometry( 1, 1, 1 );
  				const material = new THREE.MeshPhysicalMaterial( { color: 0x00ff00, transparent: true, opacity: 0.3 } );
  				const cube = new THREE.Mesh( geometry, material );
				scene.add( cube );
			
				renderer = new THREE.WebGLRenderer();
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( window.innerWidth, window.innerHeight );
				renderer.setAnimationLoop( animate );

				container.appendChild( renderer.domElement );
			
				composer = new EffectComposer( renderer );
				composer.setPixelRatio( window.devicePixelRatio );
				composer.setSize( window.innerWidth, window.innerHeight );
				composer.addPass( new RenderPass( scene, camera ) );
				composer.addPass( new OutputPass() );


				const controls = new OrbitControls( camera, renderer.domElement );
				controls.minDistance = 2;
				controls.maxDistance = 10;
				controls.target.set( 0, 0, - 0.2 );
				controls.update();

				gui = new GUI();
				gui.width = 350;
				gui.add( params, 'add_RenderPass_OutputPass' );

				window.addEventListener( 'resize', onWindowResize );

			}

			function onWindowResize() {

				camera.aspect = window.innerWidth / window.innerHeight;
				camera.updateProjectionMatrix();

				renderer.setSize( window.innerWidth, window.innerHeight );
				composer.setSize( window.innerWidth, window.innerHeight );

			}

			//

			function animate() {

				if ( params.add_RenderPass_OutputPass ) {

					 composer.render();
			
				} else {

					renderer.render( scene, camera );
			
				}

			}

		</script>

Live example

Screenshots

44 33

Version

r166

Device

No response

Browser

No response

OS

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 26, 2024

Duplicate of #27184.

@Mugen87 Mugen87 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
@Mugen87 Mugen87 added this to the r168 milestone Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants