![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 3d Reflection effects Hello, I'm trying to achieve some mirror effects like those seen here: http://www.microsoft.com/max/ From Adam Smith's post a while back, he suggested a couple ways to go about this: 1) Add each element twice to your viewport. For copied items, flip em, and apply a gradient, blending the original to an opaque color. 2) Add a second viewport which holds the same items the first viewport, but flip the camera. I'm a 3D newb, so please do correct me if I'm wrong, but it seems as though the (2) approach would not work to achieve reflections like those in Max as items are place at several different z values. So I'm trying approach (1) right now, but I'm unsure of which transforms I would need to apply for the reflection. I'm currently adding these transformations to my cloned Model3DGroup in the OnLoaded() a) rotation 180 around z axis b) translate it down But how do I obtain the inverted image? Do I need to apply a ScaleTransform3D with negative values? Or is there a much simpler way to go about this? I'm currently using Nov '5 CTP bits. Thanks in advanced. CK |
My System Specs![]() |
| | #2 (permalink) |
| | RE: 3d Reflection effects Use a negate scale on the image itself, then apply the imagebrush to the plane. "Craig Kelly" wrote: > Hello, > > I'm trying to achieve some mirror effects like those seen here: > http://www.microsoft.com/max/ > > From Adam Smith's post a while back, he suggested a couple ways to go about > this: > 1) Add each element twice to your viewport. For copied items, flip em, and > apply a gradient, blending the original to an opaque color. > 2) Add a second viewport which holds the same items the first viewport, but > flip the camera. > > I'm a 3D newb, so please do correct me if I'm wrong, but it seems as though > the (2) approach would not work to achieve reflections like those in Max as > items are place at several different z values. > > So I'm trying approach (1) right now, but I'm unsure of which transforms I > would need to apply for the reflection. I'm currently adding these > transformations to my cloned Model3DGroup in the OnLoaded() > > a) rotation 180 around z axis > b) translate it down > > But how do I obtain the inverted image? Do I need to apply a > ScaleTransform3D with negative values? Or is there a much simpler way to go > about this? I'm currently using Nov '5 CTP bits. > > Thanks in advanced. > > CK |
My System Specs![]() |
| | #3 (permalink) |
| | Re: 3d Reflection effects That works to mirror the contents, but if the mesh itself isn't symmetric about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm mentally picturing a "reflective table" mirror for this example), I think this will still look incorrect. Consider a mesh with 1 equilateral triangle in the X-Y plane, point to the +X direction (so there's a flat side in the -X direction). Rotating this 180 about Z and translating -Y will end up with a triangle with a point in the -X direction. My suggestion was indeed to use a -1 scale in the camera (in whatever direction you want as the normal for the mirror). You may also need a center, if you don't want to mirror about the origin. You should then be able to re-use (share) all of the Model3Ds in your scene, which'll reduce the working set (duplicating meshes can be expensive, if they're large). -Adam Smith [MS] "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... > Use a negate scale on the image itself, then apply the imagebrush to the > plane. > > "Craig Kelly" wrote: > >> Hello, >> >> I'm trying to achieve some mirror effects like those seen here: >> http://www.microsoft.com/max/ >> >> From Adam Smith's post a while back, he suggested a couple ways to go >> about >> this: >> 1) Add each element twice to your viewport. For copied items, flip em, >> and >> apply a gradient, blending the original to an opaque color. >> 2) Add a second viewport which holds the same items the first viewport, >> but >> flip the camera. >> >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems as >> though >> the (2) approach would not work to achieve reflections like those in Max >> as >> items are place at several different z values. >> >> So I'm trying approach (1) right now, but I'm unsure of which transforms >> I >> would need to apply for the reflection. I'm currently adding these >> transformations to my cloned Model3DGroup in the OnLoaded() >> >> a) rotation 180 around z axis >> b) translate it down >> >> But how do I obtain the inverted image? Do I need to apply a >> ScaleTransform3D with negative values? Or is there a much simpler way to >> go >> about this? I'm currently using Nov '5 CTP bits. >> >> Thanks in advanced. >> >> CK |
My System Specs![]() |
| | #4 (permalink) |
| | Re: 3d Reflection effects So first, (Daniel?,) I tried applying a negative scale ImageBrush transform, but then I ended up with an image that was so opaque that I couldn't even tell if it was mirrored it or not. Not sure if the resulting opacity is a bug, or expected behavior. I'm using Nov '05 CTP. Adam, I see what you mean about the rotating about the X-axis and a translate not mirroring. Sounds like your suggestion of using a -1 scale for the camera would require multiple viewports? I had written off multiple viewports because I didn't think it would work to achieve the effects found here: http://www.microsoft.com/max/ There, some of the objects like the 'Max' logo are positioned ontop of where other objects are reflecting. Or have I missed something? Assuming that I'm wrong about multiple viewports (pretty safe bet here), when you talk about -1 scale for the camera, do you mean changing the UpDirection? And about sharing models, I noticed that I have had to explicitly call 'Clone' to add the reflected objects. How do I set that up so that they are using references instead of copies? Thanks so much for your help guys -CK "Adam Smith [MS]" wrote: > That works to mirror the contents, but if the mesh itself isn't symmetric > about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm > mentally picturing a "reflective table" mirror for this example), I think > this will still look incorrect. Consider a mesh with 1 equilateral triangle > in the X-Y plane, point to the +X direction (so there's a flat side in > the -X direction). Rotating this 180 about Z and translating -Y will end up > with a triangle with a point in the -X direction. > > My suggestion was indeed to use a -1 scale in the camera (in whatever > direction you want as the normal for the mirror). You may also need a > center, if you don't want to mirror about the origin. You should then be > able to re-use (share) all of the Model3Ds in your scene, which'll reduce > the working set (duplicating meshes can be expensive, if they're large). > > -Adam Smith [MS] > > "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message > news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... > > Use a negate scale on the image itself, then apply the imagebrush to the > > plane. > > > > "Craig Kelly" wrote: > > > >> Hello, > >> > >> I'm trying to achieve some mirror effects like those seen here: > >> http://www.microsoft.com/max/ > >> > >> From Adam Smith's post a while back, he suggested a couple ways to go > >> about > >> this: > >> 1) Add each element twice to your viewport. For copied items, flip em, > >> and > >> apply a gradient, blending the original to an opaque color. > >> 2) Add a second viewport which holds the same items the first viewport, > >> but > >> flip the camera. > >> > >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems as > >> though > >> the (2) approach would not work to achieve reflections like those in Max > >> as > >> items are place at several different z values. > >> > >> So I'm trying approach (1) right now, but I'm unsure of which transforms > >> I > >> would need to apply for the reflection. I'm currently adding these > >> transformations to my cloned Model3DGroup in the OnLoaded() > >> > >> a) rotation 180 around z axis > >> b) translate it down > >> > >> But how do I obtain the inverted image? Do I need to apply a > >> ScaleTransform3D with negative values? Or is there a much simpler way to > >> go > >> about this? I'm currently using Nov '5 CTP bits. > >> > >> Thanks in advanced. > >> > >> CK > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: 3d Reflection effects You're right about using multiple Viewports if you transform the Camera - I believe that because of the way a reflective surface works, all "real" objects will be on top of all mirrored objects. As a result, you can use two Viewports, where the reflected contents are in one Viewport and the "real" contents are in another Viewport on top (in 2d) of the reflection's Viewport. This technique allows you to place a 2d gradient between the two to simulate an attenuated reflection, if you like. You should also be able to do this within the 3D scene if you create two root groups - one will contain the entire "real" scene, and the other will contain one child with an appropriate -1 scale which will then also have (as children) the entire real scene again. If you want to place a reflective surface into the world in this choice, you'll need to make a Mesh to do so - an advantage here is that the surface will be lit. As for sharing - you shouldn't have to Clone in general (though there may be reasons in your code - databinding and dynamic resource references come to mind). If you don't have databinding/resource references, does something not work if you just share? -Adam Smith [MS] "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message news:F47CD1EC-2C10-4AA3-B19C-EE5AF43EC4B0@microsoft.com... > So first, (Daniel?,) I tried applying a negative scale ImageBrush > transform, > but then I ended up with an image that was so opaque that I couldn't even > tell if it was mirrored it or not. Not sure if the resulting opacity is a > bug, or expected behavior. I'm using Nov '05 CTP. > > Adam, I see what you mean about the rotating about the X-axis and a > translate not mirroring. Sounds like your suggestion of using a -1 scale > for > the camera would require multiple viewports? I had written off multiple > viewports because I didn't think it would work to achieve the effects > found > here: > http://www.microsoft.com/max/ > > There, some of the objects like the 'Max' logo are positioned ontop of > where > other objects are reflecting. Or have I missed something? > > Assuming that I'm wrong about multiple viewports (pretty safe bet here), > when you talk about -1 scale for the camera, do you mean changing the > UpDirection? And about sharing models, I noticed that I have had to > explicitly call 'Clone' to add the reflected objects. How do I set that > up > so that they are using references instead of copies? > > Thanks so much for your help guys > > -CK > > "Adam Smith [MS]" wrote: > >> That works to mirror the contents, but if the mesh itself isn't symmetric >> about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm >> mentally picturing a "reflective table" mirror for this example), I think >> this will still look incorrect. Consider a mesh with 1 equilateral >> triangle >> in the X-Y plane, point to the +X direction (so there's a flat side in >> the -X direction). Rotating this 180 about Z and translating -Y will end >> up >> with a triangle with a point in the -X direction. >> >> My suggestion was indeed to use a -1 scale in the camera (in whatever >> direction you want as the normal for the mirror). You may also need a >> center, if you don't want to mirror about the origin. You should then be >> able to re-use (share) all of the Model3Ds in your scene, which'll reduce >> the working set (duplicating meshes can be expensive, if they're large). >> >> -Adam Smith [MS] >> >> "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message >> news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... >> > Use a negate scale on the image itself, then apply the imagebrush to >> > the >> > plane. >> > >> > "Craig Kelly" wrote: >> > >> >> Hello, >> >> >> >> I'm trying to achieve some mirror effects like those seen here: >> >> http://www.microsoft.com/max/ >> >> >> >> From Adam Smith's post a while back, he suggested a couple ways to go >> >> about >> >> this: >> >> 1) Add each element twice to your viewport. For copied items, flip em, >> >> and >> >> apply a gradient, blending the original to an opaque color. >> >> 2) Add a second viewport which holds the same items the first >> >> viewport, >> >> but >> >> flip the camera. >> >> >> >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems as >> >> though >> >> the (2) approach would not work to achieve reflections like those in >> >> Max >> >> as >> >> items are place at several different z values. >> >> >> >> So I'm trying approach (1) right now, but I'm unsure of which >> >> transforms >> >> I >> >> would need to apply for the reflection. I'm currently adding these >> >> transformations to my cloned Model3DGroup in the OnLoaded() >> >> >> >> a) rotation 180 around z axis >> >> b) translate it down >> >> >> >> But how do I obtain the inverted image? Do I need to apply a >> >> ScaleTransform3D with negative values? Or is there a much simpler way >> >> to >> >> go >> >> about this? I'm currently using Nov '5 CTP bits. >> >> >> >> Thanks in advanced. >> >> >> >> CK >> >> >> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: 3d Reflection effects Aha, having two viewports on top of each other - that makes sense now. I had them stacked like in the 'Boing' sample I've looked at. The other good news, is that now the reference stuff seems to be working just fine now. Too little coffee yesterday (or perhaps too much). But I'm unfortunately still confused about 'inverting' the camera in the 2nd viewport. I can think of a couple ways how one might achieve the inversion: 1) Through scale transformations done on the root of the 3dmodel. I get strange results with this approach - might be a coffee thing 2) or by adjusting the UpDirection on the camera. The UpDirection in my source viewport's camera is "0,1,0". For the 2nd viewport, I would think that I should have at least some portion of the UpDirection would have to be in the z-direction, but the "0,1,0" looks exactly the same as "0,1,1". Likewise with "1,0,1" and "1,0,0" . By specifiying "0,-1,0" the object looks flipped, but to take your triangle example, the 'point' is pointing the wrong way. Have I missed something again? Really appreciate it CK "Adam Smith [MS]" wrote: > You're right about using multiple Viewports if you transform the Camera - I > believe that because of the way a reflective surface works, all "real" > objects will be on top of all mirrored objects. As a result, you can use > two Viewports, where the reflected contents are in one Viewport and the > "real" contents are in another Viewport on top (in 2d) of the reflection's > Viewport. This technique allows you to place a 2d gradient between the two > to simulate an attenuated reflection, if you like. > > You should also be able to do this within the 3D scene if you create two > root groups - one will contain the entire "real" scene, and the other will > contain one child with an appropriate -1 scale which will then also have (as > children) the entire real scene again. If you want to place a reflective > surface into the world in this choice, you'll need to make a Mesh to do so - > an advantage here is that the surface will be lit. > > As for sharing - you shouldn't have to Clone in general (though there may be > reasons in your code - databinding and dynamic resource references come to > mind). If you don't have databinding/resource references, does something > not work if you just share? > > -Adam Smith [MS] > > > "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message > news:F47CD1EC-2C10-4AA3-B19C-EE5AF43EC4B0@microsoft.com... > > So first, (Daniel?,) I tried applying a negative scale ImageBrush > > transform, > > but then I ended up with an image that was so opaque that I couldn't even > > tell if it was mirrored it or not. Not sure if the resulting opacity is a > > bug, or expected behavior. I'm using Nov '05 CTP. > > > > Adam, I see what you mean about the rotating about the X-axis and a > > translate not mirroring. Sounds like your suggestion of using a -1 scale > > for > > the camera would require multiple viewports? I had written off multiple > > viewports because I didn't think it would work to achieve the effects > > found > > here: > > http://www.microsoft.com/max/ > > > > There, some of the objects like the 'Max' logo are positioned ontop of > > where > > other objects are reflecting. Or have I missed something? > > > > Assuming that I'm wrong about multiple viewports (pretty safe bet here), > > when you talk about -1 scale for the camera, do you mean changing the > > UpDirection? And about sharing models, I noticed that I have had to > > explicitly call 'Clone' to add the reflected objects. How do I set that > > up > > so that they are using references instead of copies? > > > > Thanks so much for your help guys > > > > -CK > > > > "Adam Smith [MS]" wrote: > > > >> That works to mirror the contents, but if the mesh itself isn't symmetric > >> about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm > >> mentally picturing a "reflective table" mirror for this example), I think > >> this will still look incorrect. Consider a mesh with 1 equilateral > >> triangle > >> in the X-Y plane, point to the +X direction (so there's a flat side in > >> the -X direction). Rotating this 180 about Z and translating -Y will end > >> up > >> with a triangle with a point in the -X direction. > >> > >> My suggestion was indeed to use a -1 scale in the camera (in whatever > >> direction you want as the normal for the mirror). You may also need a > >> center, if you don't want to mirror about the origin. You should then be > >> able to re-use (share) all of the Model3Ds in your scene, which'll reduce > >> the working set (duplicating meshes can be expensive, if they're large). > >> > >> -Adam Smith [MS] > >> > >> "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message > >> news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... > >> > Use a negate scale on the image itself, then apply the imagebrush to > >> > the > >> > plane. > >> > > >> > "Craig Kelly" wrote: > >> > > >> >> Hello, > >> >> > >> >> I'm trying to achieve some mirror effects like those seen here: > >> >> http://www.microsoft.com/max/ > >> >> > >> >> From Adam Smith's post a while back, he suggested a couple ways to go > >> >> about > >> >> this: > >> >> 1) Add each element twice to your viewport. For copied items, flip em, > >> >> and > >> >> apply a gradient, blending the original to an opaque color. > >> >> 2) Add a second viewport which holds the same items the first > >> >> viewport, > >> >> but > >> >> flip the camera. > >> >> > >> >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems as > >> >> though > >> >> the (2) approach would not work to achieve reflections like those in > >> >> Max > >> >> as > >> >> items are place at several different z values. > >> >> > >> >> So I'm trying approach (1) right now, but I'm unsure of which > >> >> transforms > >> >> I > >> >> would need to apply for the reflection. I'm currently adding these > >> >> transformations to my cloned Model3DGroup in the OnLoaded() > >> >> > >> >> a) rotation 180 around z axis > >> >> b) translate it down > >> >> > >> >> But how do I obtain the inverted image? Do I need to apply a > >> >> ScaleTransform3D with negative values? Or is there a much simpler way > >> >> to > >> >> go > >> >> about this? I'm currently using Nov '5 CTP bits. > >> >> > >> >> Thanks in advanced. > >> >> > >> >> CK > >> > >> > >> > > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: 3d Reflection effects Craig, Would you be willing to show how you were able to do this? Or maybe give some pointers on how to start? I've been reviewing Xaml and find this very interesting. "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message news 978432C-9E70-4E6E-995F-42CB1BA4B596@microsoft.com...> Aha, having two viewports on top of each other - that makes sense now. I > had > them stacked like in the 'Boing' sample I've looked at. > > The other good news, is that now the reference stuff seems to be working > just fine now. Too little coffee yesterday (or perhaps too much). > > But I'm unfortunately still confused about 'inverting' the camera in the > 2nd > viewport. I can think of a couple ways how one might achieve the > inversion: > 1) Through scale transformations done on the root of the 3dmodel. > I get strange results with this approach - might be a coffee thing > > 2) or by adjusting the UpDirection on the camera. > The UpDirection in my source viewport's camera is "0,1,0". For the 2nd > viewport, I would think that I should have at least some portion of the > UpDirection would have to be in the z-direction, but the "0,1,0" looks > exactly the same as "0,1,1". Likewise with "1,0,1" and "1,0,0" . By > specifiying "0,-1,0" the object looks flipped, but to take your triangle > example, the 'point' is pointing the wrong way. > > Have I missed something again? > > Really appreciate it > > CK > > "Adam Smith [MS]" wrote: > >> You're right about using multiple Viewports if you transform the Camera - >> I >> believe that because of the way a reflective surface works, all "real" >> objects will be on top of all mirrored objects. As a result, you can use >> two Viewports, where the reflected contents are in one Viewport and the >> "real" contents are in another Viewport on top (in 2d) of the >> reflection's >> Viewport. This technique allows you to place a 2d gradient between the >> two >> to simulate an attenuated reflection, if you like. >> >> You should also be able to do this within the 3D scene if you create two >> root groups - one will contain the entire "real" scene, and the other >> will >> contain one child with an appropriate -1 scale which will then also have >> (as >> children) the entire real scene again. If you want to place a reflective >> surface into the world in this choice, you'll need to make a Mesh to do >> so - >> an advantage here is that the surface will be lit. >> >> As for sharing - you shouldn't have to Clone in general (though there may >> be >> reasons in your code - databinding and dynamic resource references come >> to >> mind). If you don't have databinding/resource references, does something >> not work if you just share? >> >> -Adam Smith [MS] >> >> >> "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message >> news:F47CD1EC-2C10-4AA3-B19C-EE5AF43EC4B0@microsoft.com... >> > So first, (Daniel?,) I tried applying a negative scale ImageBrush >> > transform, >> > but then I ended up with an image that was so opaque that I couldn't >> > even >> > tell if it was mirrored it or not. Not sure if the resulting opacity is >> > a >> > bug, or expected behavior. I'm using Nov '05 CTP. >> > >> > Adam, I see what you mean about the rotating about the X-axis and a >> > translate not mirroring. Sounds like your suggestion of using a -1 >> > scale >> > for >> > the camera would require multiple viewports? I had written off multiple >> > viewports because I didn't think it would work to achieve the effects >> > found >> > here: >> > http://www.microsoft.com/max/ >> > >> > There, some of the objects like the 'Max' logo are positioned ontop of >> > where >> > other objects are reflecting. Or have I missed something? >> > >> > Assuming that I'm wrong about multiple viewports (pretty safe bet >> > here), >> > when you talk about -1 scale for the camera, do you mean changing the >> > UpDirection? And about sharing models, I noticed that I have had to >> > explicitly call 'Clone' to add the reflected objects. How do I set >> > that >> > up >> > so that they are using references instead of copies? >> > >> > Thanks so much for your help guys >> > >> > -CK >> > >> > "Adam Smith [MS]" wrote: >> > >> >> That works to mirror the contents, but if the mesh itself isn't >> >> symmetric >> >> about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm >> >> mentally picturing a "reflective table" mirror for this example), I >> >> think >> >> this will still look incorrect. Consider a mesh with 1 equilateral >> >> triangle >> >> in the X-Y plane, point to the +X direction (so there's a flat side in >> >> the -X direction). Rotating this 180 about Z and translating -Y will >> >> end >> >> up >> >> with a triangle with a point in the -X direction. >> >> >> >> My suggestion was indeed to use a -1 scale in the camera (in whatever >> >> direction you want as the normal for the mirror). You may also need a >> >> center, if you don't want to mirror about the origin. You should then >> >> be >> >> able to re-use (share) all of the Model3Ds in your scene, which'll >> >> reduce >> >> the working set (duplicating meshes can be expensive, if they're >> >> large). >> >> >> >> -Adam Smith [MS] >> >> >> >> "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message >> >> news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... >> >> > Use a negate scale on the image itself, then apply the imagebrush to >> >> > the >> >> > plane. >> >> > >> >> > "Craig Kelly" wrote: >> >> > >> >> >> Hello, >> >> >> >> >> >> I'm trying to achieve some mirror effects like those seen here: >> >> >> http://www.microsoft.com/max/ >> >> >> >> >> >> From Adam Smith's post a while back, he suggested a couple ways to >> >> >> go >> >> >> about >> >> >> this: >> >> >> 1) Add each element twice to your viewport. For copied items, flip >> >> >> em, >> >> >> and >> >> >> apply a gradient, blending the original to an opaque color. >> >> >> 2) Add a second viewport which holds the same items the first >> >> >> viewport, >> >> >> but >> >> >> flip the camera. >> >> >> >> >> >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems >> >> >> as >> >> >> though >> >> >> the (2) approach would not work to achieve reflections like those >> >> >> in >> >> >> Max >> >> >> as >> >> >> items are place at several different z values. >> >> >> >> >> >> So I'm trying approach (1) right now, but I'm unsure of which >> >> >> transforms >> >> >> I >> >> >> would need to apply for the reflection. I'm currently adding these >> >> >> transformations to my cloned Model3DGroup in the OnLoaded() >> >> >> >> >> >> a) rotation 180 around z axis >> >> >> b) translate it down >> >> >> >> >> >> But how do I obtain the inverted image? Do I need to apply a >> >> >> ScaleTransform3D with negative values? Or is there a much simpler >> >> >> way >> >> >> to >> >> >> go >> >> >> about this? I'm currently using Nov '5 CTP bits. >> >> >> >> >> >> Thanks in advanced. >> >> >> >> >> >> CK >> >> >> >> >> >> >> >> >> |
My System Specs![]() |
| | #8 (permalink) |
| | Re: 3d Reflection effects I believe it's new with Nov CTP, but all Camera classes now have a "Transform" property - so you can use this to perform the scale-inversion. -Adam Smith [MS] "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message news 978432C-9E70-4E6E-995F-42CB1BA4B596@microsoft.com...> Aha, having two viewports on top of each other - that makes sense now. I > had > them stacked like in the 'Boing' sample I've looked at. > > The other good news, is that now the reference stuff seems to be working > just fine now. Too little coffee yesterday (or perhaps too much). > > But I'm unfortunately still confused about 'inverting' the camera in the > 2nd > viewport. I can think of a couple ways how one might achieve the > inversion: > 1) Through scale transformations done on the root of the 3dmodel. > I get strange results with this approach - might be a coffee thing > > 2) or by adjusting the UpDirection on the camera. > The UpDirection in my source viewport's camera is "0,1,0". For the 2nd > viewport, I would think that I should have at least some portion of the > UpDirection would have to be in the z-direction, but the "0,1,0" looks > exactly the same as "0,1,1". Likewise with "1,0,1" and "1,0,0" . By > specifiying "0,-1,0" the object looks flipped, but to take your triangle > example, the 'point' is pointing the wrong way. > > Have I missed something again? > > Really appreciate it > > CK > > "Adam Smith [MS]" wrote: > >> You're right about using multiple Viewports if you transform the Camera - >> I >> believe that because of the way a reflective surface works, all "real" >> objects will be on top of all mirrored objects. As a result, you can use >> two Viewports, where the reflected contents are in one Viewport and the >> "real" contents are in another Viewport on top (in 2d) of the >> reflection's >> Viewport. This technique allows you to place a 2d gradient between the >> two >> to simulate an attenuated reflection, if you like. >> >> You should also be able to do this within the 3D scene if you create two >> root groups - one will contain the entire "real" scene, and the other >> will >> contain one child with an appropriate -1 scale which will then also have >> (as >> children) the entire real scene again. If you want to place a reflective >> surface into the world in this choice, you'll need to make a Mesh to do >> so - >> an advantage here is that the surface will be lit. >> >> As for sharing - you shouldn't have to Clone in general (though there may >> be >> reasons in your code - databinding and dynamic resource references come >> to >> mind). If you don't have databinding/resource references, does something >> not work if you just share? >> >> -Adam Smith [MS] >> >> >> "Craig Kelly" <CraigKelly@discussions.microsoft.com> wrote in message >> news:F47CD1EC-2C10-4AA3-B19C-EE5AF43EC4B0@microsoft.com... >> > So first, (Daniel?,) I tried applying a negative scale ImageBrush >> > transform, >> > but then I ended up with an image that was so opaque that I couldn't >> > even >> > tell if it was mirrored it or not. Not sure if the resulting opacity is >> > a >> > bug, or expected behavior. I'm using Nov '05 CTP. >> > >> > Adam, I see what you mean about the rotating about the X-axis and a >> > translate not mirroring. Sounds like your suggestion of using a -1 >> > scale >> > for >> > the camera would require multiple viewports? I had written off multiple >> > viewports because I didn't think it would work to achieve the effects >> > found >> > here: >> > http://www.microsoft.com/max/ >> > >> > There, some of the objects like the 'Max' logo are positioned ontop of >> > where >> > other objects are reflecting. Or have I missed something? >> > >> > Assuming that I'm wrong about multiple viewports (pretty safe bet >> > here), >> > when you talk about -1 scale for the camera, do you mean changing the >> > UpDirection? And about sharing models, I noticed that I have had to >> > explicitly call 'Clone' to add the reflected objects. How do I set >> > that >> > up >> > so that they are using references instead of copies? >> > >> > Thanks so much for your help guys >> > >> > -CK >> > >> > "Adam Smith [MS]" wrote: >> > >> >> That works to mirror the contents, but if the mesh itself isn't >> >> symmetric >> >> about the Y-Z plane (or the plane perpendicular to the "mirror" - I'm >> >> mentally picturing a "reflective table" mirror for this example), I >> >> think >> >> this will still look incorrect. Consider a mesh with 1 equilateral >> >> triangle >> >> in the X-Y plane, point to the +X direction (so there's a flat side in >> >> the -X direction). Rotating this 180 about Z and translating -Y will >> >> end >> >> up >> >> with a triangle with a point in the -X direction. >> >> >> >> My suggestion was indeed to use a -1 scale in the camera (in whatever >> >> direction you want as the normal for the mirror). You may also need a >> >> center, if you don't want to mirror about the origin. You should then >> >> be >> >> able to re-use (share) all of the Model3Ds in your scene, which'll >> >> reduce >> >> the working set (duplicating meshes can be expensive, if they're >> >> large). >> >> >> >> -Adam Smith [MS] >> >> >> >> "TheRHogue" <TheRHogue@discussions.microsoft.com> wrote in message >> >> news:41EC828F-BEF9-4A05-BCF1-F6DEF9673ACB@microsoft.com... >> >> > Use a negate scale on the image itself, then apply the imagebrush to >> >> > the >> >> > plane. >> >> > >> >> > "Craig Kelly" wrote: >> >> > >> >> >> Hello, >> >> >> >> >> >> I'm trying to achieve some mirror effects like those seen here: >> >> >> http://www.microsoft.com/max/ >> >> >> >> >> >> From Adam Smith's post a while back, he suggested a couple ways to >> >> >> go >> >> >> about >> >> >> this: >> >> >> 1) Add each element twice to your viewport. For copied items, flip >> >> >> em, >> >> >> and >> >> >> apply a gradient, blending the original to an opaque color. >> >> >> 2) Add a second viewport which holds the same items the first >> >> >> viewport, >> >> >> but >> >> >> flip the camera. >> >> >> >> >> >> I'm a 3D newb, so please do correct me if I'm wrong, but it seems >> >> >> as >> >> >> though >> >> >> the (2) approach would not work to achieve reflections like those >> >> >> in >> >> >> Max >> >> >> as >> >> >> items are place at several different z values. >> >> >> >> >> >> So I'm trying approach (1) right now, but I'm unsure of which >> >> >> transforms >> >> >> I >> >> >> would need to apply for the reflection. I'm currently adding these >> >> >> transformations to my cloned Model3DGroup in the OnLoaded() >> >> >> >> >> >> a) rotation 180 around z axis >> >> >> b) translate it down >> >> >> >> >> >> But how do I obtain the inverted image? Do I need to apply a >> >> >> ScaleTransform3D with negative values? Or is there a much simpler >> >> >> way >> >> >> to >> >> >> go >> >> >> about this? I'm currently using Nov '5 CTP bits. >> >> >> >> >> >> Thanks in advanced. >> >> >> >> >> >> CK >> >> >> >> >> >> >> >> >> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Question on Reflection | .NET General | |||
| reflection, COM, and Vista | .NET General | |||
| Retrieve name of VB6 calling app via reflection from C# COM interf | .NET General | |||