Scripting tip: change UV Address mode on the fly

by Frédéric Colin 15. December 2010 16:41

Sometimes, it may userful to change on the fly UV address Mode to clamp textures. But when there are too many textures, it's time consumming. So, I've just added a little script on the wiki to demonstrate it.

Enjoy!

How to store a state in a Nova scene

by Frédéric Colin 1. September 2010 09:03

There are many possibilities to store user data inside a Nova Scene. That's why I've just added a new sample on Nova Wiki.

If you are interested, just have a look here.

SDK Tip: create a perpendicular plane to the camera

by Frédéric Colin 30. August 2010 06:28

Sometimes, it may be useful to create a kind of panel perpendicular to the active camera. That's why, I've added a new page to demonstrate it on our wiki

Enjoy!

Scripting tip: change Nova Standard Material textures on the fly

by Frédéric Colin 27. July 2010 17:51

I continue my series of publication on Nova scripting by demonstrating the ability to load your materials' textures on the fly from external files.

That happens here.

Enjoy!

 

Nova Script Editor

by Frédéric Colin 20. July 2010 18:08

Do you know that some Visual Studio Shortcuts are available in the Nova Script Editor. Here is a partial list:

  • ctrl-S => save the script
  • ctrl-K + ctrl-C => comment all selected line
  • ctrl-K + ctrl-U => un-comment all selected line
  • ctrl-space => launch intellisense list
  • ctrl-M + ctrl-O => collapse all code to definitions
  • ...

Change scene quality on the fly

by Frédéric Colin 24. June 2010 22:45

A very good question I was asked recently about the possibility of change on the fly graphics quality of a scene. It's indeed possible in different ways:

  • Using Nova Studio: just go to the "Developer" menu and click on Engine Options:

This options will display the following panel that will allow you to enable or disable any Nova quality options and channels and therefore the speed of rendering.

  • Using Nova scripting, Nova plugin model or Nova SDK. Indeed all Nova quality options and channels are available through Nova Object Model. In the following script, I first create a slider that will change on the fly Nova Engine option according 3 values ranges:
    • From 0.0 to 1.0 excluded: main quality options are disabled.
    • From 1.0 to 2.0 excluded: some quality options are enabled.
    • Else: all quality options are enabled.
Class Script

    Private slider As NovaSlider
    Private currentScene As NovaScene 
    
    Public Sub New(scene As NovaScene)
        currentScene = scene
        slider = Scene.CreateSlider()

        slider.Top = 10
        slider.Left = 10

        slider.Min = 0.0
        slider.Max = 3.0
        slider.Value = slider.Max
        slider.Width = 300
        slider.ID = "SliderQualitySensor"
        slider.Text = "Quality Sensor"
        slider.RelativeWidth = False
        slider.Visible = True
        
        AddHandler slider.ValueChanged, AddressOf manageValueChanged
    End Sub

    Private Sub manageValueChanged(ByVal o As Object, e As EventArgs)
        If  slider.Value >= 0.0 AndAlso slider.Value < 1.0 Then
            changeToLowQuality()                
        ElseIf  slider.Value >= 1.0 AndAlso slider.Value < 2.0 Then
            changeToMediumQuality()
        Else
            changeToHighQuality()
        End If
    End Sub
    
    Private Sub changeToLowQuality()
        currentScene.Engine.QualityLevel = 0
        NovaEngine.Shadows = False
                
        NovaEngine.BumpChannel = False
        NovaEngine.SpecularChannel = False
        NovaEngine.ReflectionChannel = False
        NovaEngine.RefractionChannel = False
        Novaengine.EmissiveChannel = False
        Novaengine.AmbientChannel = False 
        NovaEngine.ParticleSystems = False
        NovaEngine.MirrorMatrixActivated = False
    End Sub
    
    Private Sub changeToMediumQuality()
        currentScene.Engine.QualityLevel = 1
        NovaEngine.Shadows = False
                
        NovaEngine.BumpChannel = True
        NovaEngine.SpecularChannel = True
        NovaEngine.ReflectionChannel = True
        NovaEngine.RefractionChannel = False
        Novaengine.EmissiveChannel = False
        Novaengine.AmbientChannel = False 
        NovaEngine.ParticleSystems = True
        NovaEngine.MirrorMatrixActivated = False
    End Sub
    
    Private Sub changeToHighQuality()
        currentScene.Engine.QualityLevel = 3
        NovaEngine.Shadows = True

        NovaEngine.BumpChannel = True
        NovaEngine.SpecularChannel = True
        NovaEngine.ReflectionChannel = True
        NovaEngine.RefractionChannel = True
        Novaengine.EmissiveChannel = True
        Novaengine.AmbientChannel = True 
        NovaEngine.ParticleSystems = True
        NovaEngine.MirrorMatrixActivated = True
    End Sub
    
    Protected Overrides Sub Finalize()
        RemoveHandler slider.ValueChanged, AddressOf manageValueChanged
        currentScene.Widgets.Clear()
    End Sub
End Class

SliderManager.nsr (2.83 kb)

New scripting tip on Vertice wiki

by Frédéric Colin 21. June 2010 17:06

I've just published a new tip on Vertice wiki. It will allow you change the active novaCamera on the fly using a joystick.

Do you know also you can publish on our wiki? So don't hesitate to contact me if you need further informations and if you think it's too difficult, you should know that everyone has talent, it's my leitmotiv! 

If you are a little bit afraid about publishing, I will help you on your first article by an author-reader cycle, so join us in the Vertice community!

Detect camera Moves in Nova script

by Frédéric Colin 19. June 2010 22:23
Just a small tip to detect camera moves on a scene with Nova script. We may think that PropertyChanged event on NovaCamera can do it, but not...
Indeed for rendering performance reasons, it's not possible to track every properties changes on NovaCamera (see wiki). So here it is a little script to track camera moves on a Nova scene.
The tip is quite simple: at the scene creation, we store initial coordinates and on every rendering we check current coordinates with the previous one (since we work on floating real, we calculate the daifference according an epsilon). After the calcultation, if there is a difference, the camera moved. Since this check is done on every rendering (ie: 30 fps), the result of differential remains true during this time. We can work on the epsilon value to reduce somewhat the sensitivity, but to reduce it further, it should be considered a lapse of time during which the audit should not take place (using a stopwath as an example).
Here is the code Code:
  Private myScene As NovaScene
    Private epsilon As Single = 0.0001
    Private cameraLastGlobalPosition As Vector3
    Private cameraLastRotationPosition As Vector3
    Private camera As NovaCamera
    
    Public Sub New(ByVal scene As NovaScene)
        myScene = scene
        
        camera = myScene.GetCamera("MainCamera")
        StoreCameraPostion()

        AddHandler myScene.AfterRender, AddressOf manageAfterRender
    End Sub

    Private Sub manageAfterRender
        If Math.Abs(CType((camera.GlobalPosition - cameraLastGlobalPosition).Length, Single)) 
> epsilon OrElse Math.Abs(CType((camera.Rotation - cameraLastRotationPosition).Length, Single)) 
> epsilon Then    
            StoreCameraPostion()
            
            PluginHelper.LogInfo("it moves!")
        End If
    End Sub

    Public Sub StoreCameraPostion()
        cameraLastGlobalPosition = camera.GlobalPosition
        cameraLastRotationPosition = camera.Rotation 
    End Sub

    Protected Overrides Sub Finalize()
        RemoveHandler myScene.AfterRender, AddressOf ManageAfterRender
    End Sub
End Class 

Web Plugin tip: Change FOV on the fly in javascript with Nova Web Plugin

by Frédéric Colin 16. June 2010 23:58

I've just wrote a new entry on the wiki. Indeed, Nova Web Pluging is a powerful tool with a complete object model to manipulate the scene in javascript.

To illustrate this fact, I developed a little javascript function to change the camera FOV on the fly.

Enjoy!

 

Extend Nova Studio scripting with your own object model: the webcast

by Frédéric Colin 25. May 2010 00:16

Since a little Webcast is certainly more efficient than words, I decided to illustrate my previous post with a video. You will be able to see how I included sms sending message on intersection detection in a Nova scene. A kind of virtual alarm in fact!

  

Enjoy!

Disclaimer
The opinions expressed herein are the author own personal opinions and do not represent their employers' view in anyway..

© Copyright 2012 Nova by Vertice Team