Scripting - How to display object contour, check full visibility to camera and get object plain image...

andwar
Freeware Edition
Joined 11 July 2009
02 January 2010 06:33:42
Hello!
I have 3 questions:
1) In scene I have an object, how can I display thin (1 pixel) contour line of object?
I need it for display selection of object. Changing object's color is unusable.
2) How I can check that certain object totally fit in viewport of camera? (All vertices of mesh are fit)
3) How to get (or generate?) image (bitmap) of one object in scene? (something like 'render-to-texture' technique)
Moach
Non-Commercial Pro Edition
Joined 20 May 2008
02 January 2010 13:00:52
1 - you can either use a special shader (you´d need to make it yourself) or you can use the famous external-inversed-shell method, where you create a "shell" around your mesh with flipped normals (in 3dsMax, use the push modifier on a copy of your model) make sure that you export the shell as a separate subgroup, so you can control it´s visibility to toggle the effect

2 - you can do this by checking the bounding box vertices against the screen rectangle, there´s a conversion function available for scenes... scene.convertWorldPosToSceneXY or something like that, and it allows you to pass in a 3d position vector and it returns you XY coordinates of where that vector appears on screen (if any value is greater than the size of the screen, then you´ll know it´s out of bounds)

3 - there is anothe scene function that renders the visible scene to a file... i think it´s scene.renderToBitmap or something (it can render to any image format such as png, jpg, etc..)
to get a single object on the render, you´ll need to loop all objects in the scene, make them invisible, make that one object visible and render, then make everything visible again... this shouldn´t be visible to the user if you do all the visibility changes in a single function...


should work... i think... hope this helps anyways


cheeerz
BUnzaga
Commercial Pro Edition
Joined 07 June 2006
02 January 2010 18:26:25
For number 2, I would suggest using boundingBoxMin and boundingBoxMax. This assumes that the bounding box isn't messed up inside DX Studio though.

If you'd like to post to this forum, just create an account on the website, or login with your existing details.

When posting to a forum, you can use limited HTML tags:- 'a' for links, 'b' for bold, 'i' for italic and 'script' to encase a block of DX Studio script.  All tags must be properly closed. e.g. <script>var i=1;</script>

Note: If there are any offensive comments in this topic, please let us know straight away at . Always follow the forum rules.