How to Disable GL_DEPTH_TEST only for one Object - opengl-es

I have a question...
Is it possible to disable the GL10.GL_DEPTH_TEST for only one Object?
In my example a have a Groundplane, with a Alphashadow Texture and I want to disable
the DEPTH_TEST for my Carmodel, to fake shadows. The other Objects should't have the DEPTH_TEST Disabled, so I wouldn't see the shadows through them.
Here is a Screenshot (the shadows aren't perfecty translated to their objects, but I think you will get my problem) https://dl.dropbox.com/u/18265107/special/screenshot.png

Anything you disable depth-test for will show on top of other stuff. You can choose to do, or not do, that for anything you like. However I don't think it will fix your shadows.
To achieve what you were wanting, disabling depth-test isn't enough, and you would need to render things in the right order:
render the ground.
render the car.
render the shadows, with depth-test disabled.
render the rest of the environment.
However this assumes the ground is flat, and that shadows don't cast onto other scene objects, which will probably look wrong.

Related

Cannot render objects in Blender

I am quite new to Blender and cannot figure out why the objects are not getting rendered. I have tried a lot of methods from various sites, but it didn't work for me, or maybe I missed some of it. I have enabled a white background for my animation, but upon rendering, I can only see a white image, this is due to the fact that the objects weren't rendered to even reach out to composite node.This is the link to my .blend file
At camera setting, you have too low Clip End distance.. And reduce sun strength, 1000 is pretty much, try 2.. :)

Three.js transform controls not interactive (won't click or hover)

I'm playing about with three.js and webGL with an attempt to get html objects overlaid on a webGL model.
I intend to use three.js object loaders to render a 3D model, where I can then allow users to overlay HTML DOM objects in 3D space via a custom UI.
I've mainly been using the various different examples in the three.js docs (https://threejs.org/examples/ and https://codepen.io/AdamEDGE/pen/RRjEwz).
In order to allow the user to move the overlaid HTML objects via the UI, I've added the transform controls (https://threejs.org/examples/misc_controls_transform.html).
Things seemed to be going relatively well up to this point, but now I see that the controls are not hoverable or clickable to move the element.
I suspect I'm either missing code or an issue with the camera not aligning correctly, but I'm very new to this so I'm guessing.
I have also experimented with Jerome Etienne's blending tutorials, but on testing that caused other issues and I think may not be worth the trouble for what I'm going for (http://learningthreejs.com/blog/2013/04/30/closing-the-gap-between-html-and-webgl/index.html).
I have created an example that shows the problem (click on an object and the controls should show).
Its a simple webGL torus with two HTML images overlaid and mapped to a Mesh so I can link the controls to the HTML elements which are on a different scene.
https://jsfiddle.net/mattscotty/h5wuq86y/
control = new THREE.TransformControls(camera, glRenderer.domElement);
control.addEventListener('change', render);
The controls show on all the correct places when clicked as expected and I can use the keyboard to change the transform type (again see https://threejs.org/examples/misc_controls_transform.html for how it should work).
As I can't click or hover, I can't hook up to the relevant events.
I'm brand new to this and I'm quite sure I'm missing something obvious, so any help is appreciated.

ScreenSpace canvas not working

I am upgrading the UI of my program (from the old Unity UI system to the new one), but it seems like I cannot work with screen-space canvas (either camera or overlay canvases). Objects in world-space canvases work fine. With screen-space GameObjects show in my "Game" preview-screen in the editor, so I am a bit confused as to what the problem may be. To be clear: objects show in the "Game" screen, but not when I press the "play" button.
I attach a composite screenshot with information about one of the objects, the canvases and the camera.
I think I now understand what the problem is. Apparently screen-space canvases (either overlay or camera) can ONLY work with UI-specific game objects. I still do not know why other sorts of elements can be added as children of these canvases (and specially why they correctly show in the Game-preview screen!)
Even if I am missing something deeper here, using elements from the UI folder works where others don't. I thought perhaps someone could find that useful.

In three.js r57, objects that are not double-sided do not show up

I am upgrading my application from three.js -r51 to -r57 (I got started before -r58 was released). When I did, I noticed that any of my 3D collada models that did not have in them a line like this:
<extra><technique><double_sided>1</double_sided></technique></extra>
did not render.
It appears that the polygons are being culled. If I force _gl.disable( _gl.CULL_FACE ); my model shows up as expected. But why would it cull all of my faces all of the time? (even if I had the winding order backward, I should see the other side of the object, right?)
It turns out that my parameter to setFaceCulling wasn't right. I was passing false instead of a culling mode.
With the r51 implementation, false happened to disable all culling.
With the r57 implementation, it dumped me into the new default behavior ... which is to enable culling and set it to cull both front and back faces.
So, I was able to fix it ... but I'm not sure I would have made that the default behavior. ;o)

Three.js-- having text overlays appear on screen

I'd like to create some mechanism that provides a text overlay on top of my 3D scene at certain times (such as when clicking a mouse button for instance.)
I'm going over the tutorials on github and notice things like the THREE.TextGeometry class. Using it I can put 3D text in the scene, but it may be a bit more than I need-- what I'm really after is a way to put some text on, say, a black background, overlay it on the scene, then move it out of the way when done. Does anyone know of good ways to do this in three.js? (If the THREE.TextGeometry class is a good way to do this that's fine, I'm just not sure how to do the overlay bit.)
Use HTML. It's super easy and powerful especially if you just need an overlay. With CSS, you can also achieve things like semi-transparent background. If you want to have it "blend" to scene, i.e. have perspective etc. you can use THREE.CSS3DRenderer which will transform divs based on camera you supply.

Resources