![]() |
|
#1
|
|||
|
|||
BTW, if you want to see yourself in the mirror you can do this:
Code:
import viz viz.go() man = viz.add('male.cfg') man.translate(0,0,4) link = viz.link(viz.MainView,man) link.preTrans([0,-1.8,0]) def addMirror(mirror,mat=None): #If mirror matrix is not specifed, get matrix of mirror object if mat is None: mat = mirror.getMatrix() #Position of mirror pos = viz.Vector(mat.getPosition()) #Direction mirror is pointing dir = viz.Vector(mat.getForward()) dir.normalize() #Quaternion rotation of mirror quat = mat.getQuat() #Create render texture tex = viz.addRenderTexture() #Create render node for rendering reflection lens = viz.addRenderNode(size=[1024,1024]) lens.attachTexture(tex) lens.setInheritView(True,viz.POST_MULT) lens.disable(viz.CULL_FACE,op=viz.OP_SET_OVERRIDE) #Setup reflection matrix rot = viz.Matrix.quat(quat) invRot = rot.inverse() lens.setMatrix(viz.Matrix.translate(pos*-1.0)*invRot*viz.Matrix.scale(1,1,-1)*rot*viz.Matrix.translate(pos)) #Setup reflection clip plane plane = vizmat.Plane(pos=pos,normal=dir) dist = plane.distance([0,0,0]) lens.clipPlane([-dir[0],-dir[1],-dir[2],dist+0.001]) #Project reflection texture onto mirror mirror.texture(tex) mirror.texGen(viz.TEXGEN_PROJECT_EYE) #Add gallery environment gallery = viz.add('gallery.ive') #Use existing painting as mirror and specify the matrix mirrorsurface = viz.addTexQuad() mirrorsurface.alpha(.2) mirrorsurface.scale(.99,.74,1) mirrorsurface.setPosition([-.329, 1.8, 2.9]) #Y,Z,X mirrorsurfacerotation = [0,0,0] #rotation around the Z,Y,X axes mirrorsurface.rotate(mirrorsurfacerotation) m = viz.Matrix() m.setPosition(mirrorsurface.getPosition(viz.ABS_GLOBAL)) m.setEuler(mirrorsurfacerotation[0]-180,-mirrorsurfacerotation[1], mirrorsurfacerotation[2]) #Z,X,Y #Apply mirror settings to mirror object addMirror(mirrorsurface,m) #Increase ambient lighting viz.MainView.getHeadLight().ambient(1,1,1) |
#2
|
|||
|
|||
@ Jerry: I already know how to see myself in the mirror. But I want to create a glass window where you can see through, but also reflects, like a real life glass window. So what I want to make is a transparent mirror. The problem is that I don't know how to make the reflection texture transparent.
|
#3
|
|||
|
|||
Using the following code makes the mirror semi-transparent for me:
Code:
mirrorsurface.alpha(.2) mirrorsurface.appearance(viz.TEXMODULATE) |
#4
|
|||
|
|||
Thanks, that was exactly what I was looking for!
I started playing around with two mirrors facing each other, but then the reflection of mirror1 is not reflected in mirror 2. Instead, you'll see a black square at the position of mirror2 in the reflection of mirror1. And when you look into mirror2, you'll see a black square at the position of mirror1. Both mirror reflections work well for the rest of the environment. I was wondering if it is possible at all to fix this. I don't really need the solution, I just want to know if it is possible. But if the solution is quite simple, then I'm all ears (or eyes ![]() |
#5
|
|||
|
|||
Thanks, that was exactly what I was looking for!
I started playing around with two mirrors facing each other, but then the reflection of mirror1 is not reflected in mirror 2. Instead, you'll see a black square at the position of mirror2 in the reflection of mirror1. And when you look into mirror2, you'll see a black square at the position of mirror1. Both mirror reflections work well for the rest of the environment. I was wondering if it is possible at all to fix this. I don't really need the solution, I just want to know if it is possible. But if the solution is quite simple, then I'm all ears (or eyes ![]() I also noticed a significant framerate drop when an avatar and it's reflection are in view. Is there any way the algorithm for the reflection texture can be modified so that the framerate won't drop (as much)? Now the drop is from 72 fps to 36 fps. |
#6
|
|||
|
|||
hope anyone can help me with my problem;
when I apply the mirroring effect, the mirroring looks fine, but the reflected model is way too bright. this line is the reason for the good looking mirror effect, but it also blows out the placed model if you take a direct look viz.MainView.getHeadLight().ambient(1,1,1) is there a possibility to exclude the effect for the model? hope anybody can help thanks in advance |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating a Vizard Sensor Plugin | farshizzo | Plug-in development | 25 | 08-01-2019 12:24 AM |
Vizard and Augmented Reality | realvision | Vizard | 4 | 04-04-2008 10:59 AM |
Vizard won't run | wouters | Vizard | 5 | 02-05-2008 11:12 AM |
Fall 2007 release of Vizard R3 | 3 D | Announcements | 0 | 10-15-2007 04:50 PM |
wxPython with Vizard | farshizzo | Vizard | 18 | 09-29-2005 08:49 AM |