Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
0
Members

THREE.js plugin - WebGLRenderer and WebGLRenderTarget not working

A topic by pixelrobin created Feb 13, 2016 Views: 1,530 Replies: 2
Viewing posts 1 to 3

This is using the three.js plugin!

I'm trying to render some island models (put into a different scene than the main Sup one) to a WebGLRenderTarget and draw it to a plane mesh via a shader.

The shader works, but the WebGL rendering doesn't. Here is my code. If anyone needs it, I could even make a demo project.

This was based on this three.js demo.

I need an answer/help really soon (as in within a day or so) because the first phase of my project is going to be due.

(+2)

- what doesn't work ? what do you see in your scene instead of what you expect ?

- what errors do you get (in the script editor and/or in the console) ?

I am no THREE.js specialist at all but I see several potential source of trouble :

You do delete the WebGLRenderer Created by Superpowers ? I have no idea if you can have several of them in a single page (or on top of each other).

You actually don't attach your WebGLRenderer to the webpage, you have to do something like :

container.appendChild( renderer.domElement ); // in the demo, container is a div

You probably need to update the time uniform yourself, too ?

You don't seems to do anything with your 'mapContentTexture'. In the demo they add it to a MeshBasicMeterial then apply this material to the spheres.

(4 edits) (+1)

I'm getting a black surface.

I'm getting no errors.

I'll look into the things you suggested, thanks for your input!


EDIT: I also tried rendering with Superpower's renderer (in gameInstance.threeRenderer) and that didn't work either. I didn't edit the time uniform, that could be the problem.

EDIT 2: trying to set the map of a MeshBasicMaterial doesn't work. Type script won't let me set a texture property to a WebGLRenderTarget.


EDIT 3: I got it! I was forgetting to do a normal render after rendering to the target. I thought it wasn't needed.

Thanks for your time and help :)