WANTED: SCENE EXAMPLES WITH >>> Camera.RenderToCubemap

Hi

In the docs you can find an editor script to generate a cube map from a given point. See below.

But what kind of script is it:

Javascript?
C sharp?
Boo?

After placing that script (Javascript) in a folder named “Editor” there is a “Render to Cube Map” item under “Game Object”

But how does it works? Choosing first an objekt? The camera? Pushing a start button?
Where is it saving the cube map (path)?

Please Unity Support: Place a short step by step explanation of how to use that script.
Thanks for education.

// Render scene from a given point into a static cube map.
// Place this script in Editor folder of your project.
// Then use the cubemap with one of Reflective shaders!
class RenderCubemapWizard extends ScriptableWizard {
    var renderFromPosition : Transform;
    var cubemap : Cubemap;
    
    function OnWizardUpdate () {
        helpString = "Select transform to render from and cubemap to render into";
        isValid = (renderFromPosition != null)  (cubemap != null);
    }
    
    function OnWizardCreate () {
        // create temporary camera for rendering
        var go = new GameObject( "CubemapCamera", Camera );
        // place it on the object
        go.transform.position = renderFromPosition.position;
        go.transform.rotation = Quaternion.identity;

        // render into cubemap        
        go.camera.RenderToCubemap( cubemap );
        
        // destroy temporary camera
        DestroyImmediate( go );
    }
    
    @MenuItem("GameObject/Render into Cubemap")
    static function RenderCubemap () {
        ScriptableWizard.DisplayWizard.<RenderCubemapWizard>(
            "Render cubemap", "Render!");
    }
}

Heellooo - Is there anybody outside of that box? :???:

This error occurs in Unity 3.5.2
if a sphere is selected in the scene and the editor script “Render into Cubemap” is called >>

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ScriptableWizard.DisplayWizard (System.String title, System.Type klass, System.String createButtonName, System.String otherButtonName)
UnityEditor.ScriptableWizard.DisplayWizard[RenderCubemapWizard] (System.String title, System.String createButtonName, System.String otherButtonName)
UnityEditor.ScriptableWizard.DisplayWizard[RenderCubemapWizard] (System.String title, System.String createButtonName)
RenderCubemapWizard.RenderCubemap () (at Assets/Editor/RenderToCubematp.js:29)
<<

Sorry for asking, but if you would place a little more information within your docs, this help begging don’t must be :frowning:
Again: How works this script exactly? Or is it not working any more with Unity 3.5.2?

Thanks Unity Support Team for answering

RenderToTexture is a Unity Pro feature and works fine under this current release

Unity Menu: Asset → Create Other → CubeMap

select GameObject Transform
select CubeMap

Thanks runner

Yes we use UnityPro.

These steps we do:

  1. Unity Menu: Asset → Create Other → CubeMap
  2. We give that asset a new name ie. rendered cubemap
  3. We select that cubemap within the inspector and call the “Render into Cubemap” function for the menu “GameObject/Render into Cube”
  4. Nothing happens but that error message:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ScriptableWizard.DisplayWizard (System.String title, System.Type klass, System.String createButtonName, System.String otherButtonName)
UnityEditor.ScriptableWizard.DisplayWizard[RenderCubemapWizard] (System.String title, System.String createButtonName, System.String otherButtonName)
UnityEditor.ScriptableWizard.DisplayWizard[RenderCubemapWizard] (System.String title, System.String createButtonName)
RenderCubemapWizard.RenderCubemap () (at Assets/Editor/RenderToCubematp.js:29)

Then you need some transform of a gameobject which we drag this gameobject from the scene into inspector of the wizard of CameraRenderToCubeMap which produces a 6 sided skybox material.

gameobject Transform (Render from Position) the camera spawns along this transform and takes pics from 6 views

I did attach a picture in my previous post but its not viewable for some reason?

also i used .js for the script

Hi runner again

But the first two steps are ok?

Because: This option window as you showed with a screen shot, we do not have at all.
Where is it?

NullReferenceException: Object reference not set to an instance of an object

above makes me think

  1. you did not drag gameobject in scene into inspector wizard slot (Render from Position)

  2. Or did not create cubemap and also add that into the cubemap slot

  3. Wizard script is in wrong location move it to Asset Folder (root)

Just trying to provide some suggestions :face_with_spiral_eyes:

Yeah,

because there is non Wizard Windows for dragging somthing into.
How can one making this Wizard Windows visible?

The steps:

  1. Choose: “Asset/Create/Cubemap”
  2. Select the new Cubemap
  3. Choose “GameObject/Render into Cubemap”
  4. An error message occures but non Wizard!

As you can see the script is on the right place.

-bumped-

The picture is showing now of the wizard

For you’re problem did you move the script out of its current location and see if the wizard shows? or does it show and not render when clicked and instead produces those errors.

Hi

It don’t depends where that script is within the Asset folder. It could be outside of the the folder “Editor” too and still it appears in the menu “GameObject”

That Wizard: Is it showing after choosing “GameObject/Render into Cubemap”? Do you have to select anything before? (I guess the empty cubemap.) But as soon as the command “Render into Cubemap” is selected, the error appears.

HEEEEELLLLLLOOOOOOOO!!!

IS THERE ANYBODY WORKING OF YOU UNITY SUPPORTER GUYS ???

I mean, we have paid a lot for our Unity 3D licenses and have to wait weeks for an answers!
Some time we don’t get any answer at all, neither here within the forum nor with a ticket over a bug report.

It sucks a bit, that the Unity Support team lets private people try to helping each other in the forum, while they drink coffee in the office…:sweat_smile: And that we must begging all the time with agreeable words, for a little bit of support!

The Script (look at the top of that thread) is not working on our Unity Pro BECAUSE:
In the docs (script references) you placed that Camera.RenderToCubemap script with the following comment:

// Render scene from a given point into a static cube map.
// Place this script in Editor folder of your project.
// Then use the cubemap with one of Reflective shaders!

BUT ALL THAT TROUBLES YOU COULD PREVENTET WITH THAT COMMENT HERE:
// Place this JAVAscript in Editor folder of your project AND NAME IT RenderCubemapWizard

Now it works.

Thankyou so much! I was trying to sort this exact issue out today and just randomly found your thread. Nice work on finding the solution and sharing it with others.

Gotta say im a complete noob, but even i know the script name needs to be the same as the class name…

Me too. I’m another who found this thread useful!

-j