Jump to content

Render image of model


joshcamas
 Share

Recommended Posts

Hello guys!!!

 

I've been working a huge amount on my editor, (it's been like 4 months now?) and I'm actually getting somewhere!

 

I've run into an interesting problem, however - the editor is going to have a list of meshes. When you hover over the mesh, I need a image to go along with it.

 

How would I do this? Render a mesh and turn it into an image during runtime... 

I hope this makes sense!

 

Thanks!

 

-Josh

 

oh, and here's a sneaky peaky of my work: :3 

 

It's not that great but hey it's progress

TmOcYjX.png?1

 

Link to comment
Share on other sites

Hi Josh!  Good to hear from you, and congrats on your editor advancements.  It looks great!

 

HI to you, too, Dad72.  Hope you guys are well.

 

If I may clarify, you want an image of the hovered mesh, correct?

 

Did you see the "render scene on a PNG" document...

 

http://babylondoc.azurewebsites.net/search.php?q=Render+Scene+on+a+PNG

 

*shrug*

 

There might be ANOTHER option.  Does it have to be an image?

 

Maybe... onHover/onMouseOver...  you could aim another BJS camera at the mesh, then render that camera viewport as a small webGL canvas  Use that canvas... in place of the image.  *shrug*  I bet you thought about that already, though.

 

One general hint.  Never LEARN something when you can steal it and re-purpose it for your own needs. :D  Later in life, when you become mega-lazy and your brain is badly damaged from abuse, this secret will be VERY handy.

 

I bet you knew THAT already, too, as I think Samac began as something else, if I remember right.  :)  But you stated that right from the start, so you are clean, noble, and honorable... and a darned good trailblazer, as well.

Link to comment
Share on other sites

Hi Wingnut,

 

It interests me to have an image of the model flying over a link. Your idea is interesting Wingnut. but I think this may hurting performance this solution.

 

The ideal is to be able to generate thumbnail images of each models from models give a bank.

Link to comment
Share on other sites

nod.  I think you are correct.  Performance issues.

 

When a user changes the texture or scaling of a mesh (its look), they would need/want to re-create the thumb pic. 

 

But this could be a non-automatic function.  The user might need to right-click, choose 'create/recreate thumbnail'.  Then a short wait, and then the thumb pic is updated/created.

 

Then hover would only pop-up (or iconify) the image IF one has been created for that mesh.

 

Josh didn't say if the image would happen near the mesh, or become an icon on a menu/toolbar.  Maybe both, and more.  :)

 

Interesting topic.

Link to comment
Share on other sites

Yeah, there would be many many icons. The image would be on a toolbar thingy. :)

I was thinking of a system that merges both of your ideas, Wingnut: have a hidden babylon engine in the background that loads the mesh, creates the scene from png, and then puts it into the html.

I'll try this out later! :D

Link to comment
Share on other sites

You can do the following:

- Create a camera

- Position you camera to have your object in his frustum

- Set your camera as scene.activeCamera

- When you want to get a picture of your mesh:

var texture = new RenderTargetTexture("screenShot", size, scene, false, false);texture.renderList = myMesh;texture.onAfterRender = () => {    Tools.DumpFramebuffer(width, height, engine);};scene.incrementRenderId();texture.render(true);texture.dispose();if (previousCamera) {    scene.activeCamera = previousCamera;}

(Please note that you'll need bjs 2.1 for this to work)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...