Render 3D scene to a bitmap / texture

Software: Away3D 4.x

mads ny larsen, Newbie
Posted: 24 July 2012 06:40 PM   Total Posts: 2

Hi
I have a question about generating textures or render to a bitmap in runtime with away3D
Im currently working on a project which generates large print sized posters out of a massive amount of generative drawed lines via AS3, but to get the right visual expression I wish to use a 3D engine like Away3D, my concern is, drawing the same image with polygon-lines would demand hundreds of millions of polygons and thereby killing the program so I need to find a cleaver way of drawing to a bitmap object after every cycle and this is where I need some advice :)
Quick note.: I have not used Away3D before but fairly agile in as3 :)

My question goes:
Im currently rendering/drawing to a 4000*4000px bitmap and then plotting to a file when it’s done.

1 - What is the best approach of drawing the content from a 3D scene to a bitmap object ? (render/draw to bitmap, texture or the like).

2 - is it possible to have a 3D scene of 4K*4K px ? or would it make more sense to have a scene of ex. 400*400px and then scale it up before copying to the bitmap object

3 - is there a predefined line drawing command in Away3D or is the best approach to use a 3-4 sided polygon ?

4 - is it possible to render the 3D scene as parallel (no perspective)

ps. Runtime performance is not the biggest issue for this project since im creating a tool for rendering images.


Thanks
Mads

   

Richard Olsson, Administrator
Posted: 24 July 2012 07:09 PM   Total Posts: 1192   [ # 1 ]

1. You should be able to use View3D.stage3DProxy.context3D.drawToBitmapData(). See the standard Flash documentation for Context3D for information on this method.

2. I’m afraid the back-buffer in Flash Player is limited to 2048x2048, so I don’t think it’s possible in any way to draw a 4000x4000 pixel bitmap without just scaling it up and thereby losing fidelity.

3. You can use the segment API, i.e. away3d.entities.SegmentSet.

4. I think that what you’re looking for is orthographic rendering, which you can achieve using the OrthographicLens. Pass an instance of that class to Camera3D when you create your camera, or set the lens property of View3D.camera.

Hope this helps!

   

mads ny larsen, Newbie
Posted: 24 July 2012 08:16 PM   Total Posts: 2   [ # 2 ]

Thanks. yes it helped smile.
Okay so there’s a limitation of the size of the 3D scene, so would it be possible to render to a texture of 4k*4k px and then throw that into a bitmapData object or even better directly export it to a file either via fileIO or some getPixel method and PHP (as im currently using since it’s a webbased application)

The only other solution I can come to think about for rendering a scene to a 4k*4k bitmap would involve moving the camera to view 2*2 sections of the scene via some crazy math :D I know this is done in unity3D but it’s pretty complex to get it to work properly.

   

Richard Olsson, Administrator
Posted: 24 July 2012 10:19 PM   Total Posts: 1192   [ # 3 ]

You won’t be able to create textures that are that big, so you will have to render the scene in four parts. The math shouldn’t be too complicated if you use orthographic projection, like you seem to want to do anyway, since there will be no perspective distortion messing things up.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X