在网络应用程序中将图像包裹在对象周围
我正在 ASP.NET 中创建一个 Web 应用程序,如下所示: http://www.zazzle.com/cr/design/pt-mug
除了将图像包裹在物体周围之外,我知道如何做所有事情。 如果我只需要将图像堆叠在上面,这将是一项简单的任务 另一个的顶部,如果它们是平的,但如果它是圆形物体,就像这个杯子一样 是的,这有点棘手。
我的第一个猜测是为 GDI+ 创建某种算法 模拟“包裹”图像围绕一个对象(实际上它不会是一个 3D 对象, 它只是它的屏幕截图)。
我认为这将是原始方法,并且会导致质量非常差, 如果我能让它发挥作用的话。
所以,我的第二个猜测是实现某种 3d 渲染器 给出某个对象的图像映射,它会将我的图像渲染到对象上 并实时返回我渲染的图像。这可能吗? 还有其他办法吗?我从哪里开始?
I'm creating a web app in ASP.NET like this one:
http://www.zazzle.com/cr/design/pt-mug
I know how to do everything except wrapping an image around an object.
It would be a simple task to do if I would only have to stack an image on
top of the other, if they were flat, but if it is a round object, as this mug
is, it's kinda tricky.
My first guess was to create some sort of algorithm for GDI+ that would
simulate "wrapping" image around an object (actualy it wouldn't be an 3d object,
it would just be a screenshot of it).
I figured it would be to raw approach and it would result in very bad quality,
if I could ever make it work.
So, my second guess was to implement somekind of 3d renderer to whom I would
give an image map for some object, it would render me that image onto an object
and in real time return me rendered image. Is that posible?
Is there any other way? Where do I start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您愿意尝试商业产品,我公司为.NET制作了一个光栅处理SDK,名为DotImage 。如果您尝试一下,请查看
PolygonTransform
。您提供一个多边形作为点列表,该类会扭曲图像以适合多边形内部。如果您需要示例代码,请告诉我。If you are willing to try a commercial product, my company makes a raster processing SDK for .NET called DotImage. If you try it, take a look at
PolygonTransform
. You supply a polygon as a list of points, and the class warps the image to fit inside the polygon. If you need sample code for it, let me know.它可能是某种 OpenGL 3D 渲染,但图像可以轻松地以纯 2D 方式变形以获得此效果。水平方向上,需要将其从杯子侧面压扁的地方。每列像素都需要根据哪一列垂直移动不同的量,这样图像的水平线就会变成“U”形。有了正确的参数,这样的变形就可以模仿正确的 3D 形状。可以通过在正确的位置稍微调亮/调暗图像来应用照明效果。
It might be some sort of OpenGL 3D rendering, but an image could easily be morphed in a purely 2D way for this effect. Horizontally, it would need to be squished where it goes off the side of the cup. Each column of pixels needs to be shifted vertically by varying amounts depending on which column - such that a horizontal line the image would become like a "U" shape. With the right parameters, such a morph could mimic the proper 3D shape. Lighting effects could be applied to, by brightening/darkening the image a bit in the right places.