简体   繁体   English

WPF 3D拉伸“位图”

[英]WPF 3D extrude “a bitmap”

I'm looking for a way to simulate a projector in wpf 3D : 我正在寻找一种在wpf 3D中模拟投影仪的方法:

i've these "in" parameters : 我有这些“输入”参数:

  • beam shape : a black and white bitmap file 光束形状:黑白位图文件

  • beam size ( ex : 30 °) 光束尺寸(ex:30°)

  • beam color 光束颜色

  • beam intensity ( dimmer ) 光束强度(调光器)

  • projector position (x,y,z) 投影机位置(x,y,z)

  • beam position (pan(x),tilt(y) relative to projector) 光束位置(相对于投影仪的水平(x),倾斜(y))

First i was thinking of using light object but it seem that wpf can't do that 首先,我在考虑使用轻型物体,但似乎wpf无法做到这一点

So, now i think that i can make for each projector a polygon from my bitmap... 所以,现在我认为我可以为每台投影机从位图制作一个多边形...

First i need to convert the black and white bitmap to vector. 首先,我需要将黑白位图转换为矢量。 Only Simple shape ( bubble, line,dot,cross ...) 仅简单形状(气泡,线,点,十字...)

Is there any WPF way to do that ? 有WPF的方法吗? Or maybe a external program file (freeware); 或者也许是一个外部程序文件(免费软件);

then i need to build the polygon, with the shape of the converted bitmap , color , size , orientation in parameter. 那么我需要用参数中转换后的位图,颜色,大小,方向的形状来构建多边形。

i don't know how can i defined the lenght of the beam , and if it can be infiny ... 我不知道如何定义光束的长度,以及它是否可以无限长...

To show the beam result, i think of making a room ( floor , wall ...) and beam will end to these wall... 为了显示光束的结果,我认为要建造一个房间(地板,墙壁...),光束会终止于这些墙壁...

i don't care of real light render ( dispersion ...) but the scene render has to be real time and at least 15 times / second (with probably from one to 100 projectors at the same time), information about position, angle,shape,color will be sent for each render... 我不在乎真实的灯光渲染(色散...),但是场景渲染必须是实时的并且至少每秒15次(可能同时有1到100台投影机),有关位置,角度的信息,形状,颜色将为每个渲染发送。

Well so, i need sample for that, i guess that all of these things could be useful for other people 好吧,我为此需要样本,我想所有这些东西可能对其他人有用

If you have sample code : 如果您有示例代码:

Convert Bitmap to vector Extrude vectors from one point with a angle parameter until collision of a wall Set x,y position of the beam depend of the projector position Set Alpha intensity of the beam, color 将位图转换为矢量使用角度参数从一个点拉伸矢量,直到墙发生碰撞设置光束的x,y位置取决于投影仪的位置设置光束的Alpha强度,颜色

Maybe i'm totally wrong and WPF is not ready for that , so advise me about other way ( xna,d3D ) with sample of course ;-) 也许我完全错了,WPF还没有为此做好准备,所以请当然向我提供其他示例(xna,d3D);-)

Thanks you 谢谢

I would represent the "beam" as a light. 我将“光束”表示为一盏灯。 I'd load the bitmap into a stencil buffer. 我将位图加载到模板缓冲区中。 You should be able to do this with OpenGL, DirectX, or XNA. 您应该能够使用OpenGL,DirectX或XNA做到这一点。 AFAIK, WPF doesn't give access to the hardware for stencil buffers or shadows. AFAIK,WPF不能访问模具缓冲区或阴影的硬件。

It seam to do "light patterns on the floor" there is two way 它缝做“地板上的灯光图案”有两种方法

use a spotlight with a cookie. 将聚光灯与Cookie配合使用。 Or Projector with a custom shader that does additive blending. 或带有自定义着色器的投影仪,该着色器可以进行添加混合。

or manually creating partially transparent polygons to simulate the "rays". 或手动创建部分透明的多边形以模拟“射线”。 and i need some example for one or the other case 我需要一个例子来说明另一种情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM