WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   putting objects on the screen (https://forum.worldviz.com/showthread.php?t=361)

jargon 05-23-2005 01:12 AM

putting objects on the screen
 
dear Farshizzo,
I was wondering if there's a way to place an object at the display screen- I specifically have a ball that I want create the illusion of distance with by scaling it manually- thus overriding Vizard's ball scaling. I tried to use

object= viz.add('object.wrl', viz.SCREEN)

but to no avail (I couldn't see the object- it dissappeared).
Maybe you have some ideas?

My other question is assuming that there is a way to place the object at the screen-- is there a way to have other objects that are behind it in the Vizard world occlude it as to make it seem like those objects are in front of my original object. THis would allow me to put this object on the screen, scale it my own way and yet have it seem like it's z position is greater than other object's (ie: it's further away from the user).

If these questions make no sense to you I'll attempt to clarify. Thanks,
Jargon

farshizzo 05-23-2005 11:23 AM

Hi,

When an object is attached to the screen its initial position is in the lower left corner. Try translating it to the center of the screen:
Code:

object.translate(0.5,0.5)
Screen coordinates are in the range [0,1], where [0,0] is the lower left corner and [1,1] is the upper right corner.

Do you want the object to be occluded by all objects or just some?

jargon 05-23-2005 12:03 PM

Nice that worked.
I want the ball to be occluded by only 1 object and only some of the time. Is this possible?

farshizzo 05-23-2005 12:41 PM

Hi,

This is somewhat tricky to do and it really depends on how many objects you are using and what kind of objects they are. Are you only going to have these two objects? What kind of objects are these?

jargon 05-23-2005 08:48 PM

farshizzo-
I guess I only have 1 object- it's a tennis court - but really it's just the net that I want to obstruct the ball. And only some of the time (when it's on my side of the court I want the ball to appear in front of the net; however on my opponent's side I want the ball to appear behind the net). If it's impossible I'll formulate another strategy
thx,
jargon

farshizzo 05-24-2005 10:59 AM

Hi,

When you want the ball to appear behind the net you would do the following:
Code:

#Ball behind net
net.disable(viz.DEPTH_TEST)
net.draworder(16)
ball.draworder(15)

Note: the net object must be separate from the ground object. When you want the ball to appear in front of the net do the following:
Code:

#Ball front net
net.enable(viz.DEPTH_TEST)
net.draworder(16)
ball.draworder(17)

Like I said earlier, this method breaks down if you have other objects in the scene that need to be in front of the net.

Out of curiosity, why do you want the ball to be attached to the screen?

farshizzo 05-24-2005 11:25 AM

Hi,

I just realized that you can have other objects in front of the net. Just set their draw order to a value higher than the net's draw order. I'm pretty sure that should work.

jargon 05-24-2005 11:31 AM

Farshizzo,
thanks for the method; The reason I was thinking of attaching the ball to the screen was to possibly scale the ball manually to create a sense of the ball travelling in the +z (scale down) or -z (scale up) direction. Right now I'm using a frustum with a locked near value- this allows for left and right navigation but disallows the confusing display effects of how near or far a person is to the screen. However, the scaling is wrong based on person position and furthermore the person's position from the screen does not equal the person's virtual court position. If this all seems confusing it kind of is. Disallowing Vizard's scaling I would be able to solve this problem; However I now have a new problem- even if I can get the ball behind the net I can never really get the ball to bounce on a specific portion of the court without taking into consideration the percieved slant of the court (ie: the ball would have to bounce at varying heights depending on how far along the court in +z it was bouncing). Eh this description is terrible. Thanks for your help,
Jargon


All times are GMT -7. The time now is 12:58 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC