x


Rendering a mesh with a given set of lights

Hi,

I am trying to render a preview panel like the default one in unity, it seems that the unity preview panel uses an inbuilt class to do it's rendering which is not exposed. What I am trying to do is render a mesh under the influence of 2 lights; but I don't want the mesh, or the lights to be part of the scene.

Does anyone have any ideas on how I could achieve this?

more ▼

asked Jul 01 '10 at 10:46 PM

Tim Cooper gravatar image

Tim Cooper
129 3 3 5

Unity has a great render, but a few extra editor API's would make life much easier. I feel that any GUI inspector that is written by unity should be able to be created using the provided api's. Unity only supports rendering of the current scene. This is done via rendering a camera. It is possible to hook this camera, but it will still requires scene lights and scene objects. There is no way to render a few arbitrary objects with arbitrary lights without adding them to a scene and then rendering that specific scene. Having a class like PreviewRenderUtility exposed would be great.

Jul 02 '10 at 02:46 PM Tim Cooper
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I don't believe there are any Editor classes that let you render scene views or objects in a separate window. I've just combed through this page:

http://unity3d.com/support/documentation/ScriptReference/20_class_hierarchy.Editor_Classes.html

and I don't see any reference to any custom rendering. I think the best you can do is attempt to write a C++ plugin for Unity (which requres Unity Pro) to try and render an object inside of an editor window, but I'm not sure if C++ plugins even work in the editor (I don't see any reason why they wouldn't, but who knows). That's probably the closest you're going to get to what you want.

more ▼

answered Jul 02 '10 at 02:32 AM

qJake gravatar image

qJake
11.6k 43 78 161

Well a custom c++ plugin would probably not achieve all that I am after as I would not be easily portable and I am also not clear on how it would be achieved given that the API's I would have access to would also not be the ones i need.

Jul 02 '10 at 02:43 PM Tim Cooper
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x492
x427
x338

asked: Jul 01 '10 at 10:46 PM

Seen: 1127 times

Last Updated: Jul 01 '10 at 10:46 PM