First if you are really lost, go to the Getting started page:
http://www.truevision3d.com/beta_howto.php
To use this new feature in TVGraphicEffect this is what you have to do.
These are the declaration that I called.
We need 2 RenderSurface. 1 is for Reflection and the Other for Refraction.
Private GraphicFX As TVGraphicEffect Private RenderSurf1 As TVRenderSurface Private RenderSurf2 As TVRenderSurface Private WaterMesh As TVMesh Private WPlane As TV_PLANE
First We Create the Water Mesh. Thats basically the water.
After that we create the 2 Rendersurface and set the size 256, 256.
Then we set the the Water Plane. Its Dist has to be the negative of the altitude we put in the WaterMesh.
Then we create TVGraphic and Initiate reflection with the paramenters.
Set WaterMesh = Scene.CreateMeshBuilder WaterMesh.AddFloor 1, -256, -256, 256, 256, 30, 1, 1, False Set RenderSurf1 = Scene.CreateRenderSurface(256, 256, True, -1) Set RenderSurf2 = Scene.CreateRenderSurface(256, 256, True, -1) WPlane.Dist = -30 WPlane.Normal = Vector3(0, 1, 0) Set GraphicFX = New TVGraphicEffect GraphicFX.SetWaterReflection WaterMesh, RenderSurf1, RenderSurf2, 0, WPlane
We have to render what will be in the reflection for both rendersurfaces. Note: Rendering the RenderSurface must be before TV.Clear
RenderSurf1.StartRender False Atmos.Atmosphere_Render Land.Render RenderSurf1.EndRender RenderSurf2.StartRender False Atmos.Atmosphere_Render Land.Render RenderSurf2.EndRender
To use this new feature in TVGraphicEffect this is what you have to do.
These are the declaration that I called. We need the RenderSurface to Render all the objects to apply the glow to.
Private TVGraphics As TVGraphicEffect Private RenderSurface As TVRenderSurface
This is what we do to set the glow.
Set TVGraphics = New TVGraphicEffect Set RenderSurface = Scene.CreateRenderSurface(256, 256, True, -1) TVGraphics.InitGlowEffect RenderSurface
We have to render what will be Glowen by rendering them in the rendersurface.
And after that we UPDATE the Glow.
Note: Rendering the RenderSurface must be before TV.Clear
Idea: You may scale the object larger when rendering in the RenderSurface to get a bigger glow.
RenderSurface.StartRender False Teapot.Render '( Render all the objects you want glown here.) RenderSurface.EndRender TVGraphics.UpdateGlow
And finally right before TV.RenderToScreen Idea: You can do this multiple times for more glow.
TVGraphics.DrawGlow
You may also have Emissive maps for Actors and Mesh. This allows for you to control the glow. Once you set it, this emissive map will be used to render the glow.
SetTextureEx(Tv_LAYER_EMISSIVE, emissivetexture)
To use this new feature in TVGraphicEffect this is what you have to do.
These are the declaration that I called.
We need the RenderSurface to Render the whole scene to add the DOF to.
Private TVGraphics As TVGraphicEffect Private RenderSurface As TVRenderSurface
This is what we do to set the DOF.
The size of the rendersurface should be same or higher then the screen rendered to since if it is smaller then it will seem that the whole scene is blurry.
iNumZLayers > The higher the number, the higher the accuracy of the depth information.
Set RenderSurf = Scene.CreateRenderSurface(512, 512, True, -1) Set GraphicFX = New TVGraphicEffect GraphicFX.InitDepthOfField 8, RenderSurf
First we update the the DOF Parameters. Then we have to render what will be rendered in the scene by rendering them in the rendersurface. After that we update the DOF.
Note: Rendering the RenderSurface must be before TV.Clear.
fFocalPlane > Distance of the focal plane to the camera, focal plane is the place where it’s not blurred.
fFocalRange > This defines the “width” of the plane in which it is not really blurred.
fBlur > Blur Factor. 0 is no blur. 3 or 4 usually creates good look. Higher numbers should be used for testing.
GraphicFX.SetDepthOfFieldParameters 5, 100, 3 RenderSurf.StartRender True Land.Render '( Render all the objects in your scene here) Teapot(0).Render GraphicFX.UpdateDepthOfField 'You have to update inside the rendering RenderSurf.EndRender
Then inside TV.Clear you dont render the scene over again, you just do this and it will render what you have previously rendered on the RenderSurface to the screen.
After this you should render your 2D objects and then TV.RenderToScreen.
GraphicFX.DrawDepthOfField
First thing you need in BumpMapping is to setup a light.
After that load the BumpMap. The last value is intensity of the BumpMap.
TextureFactory.LoadBumpTexture "..\..\..\Media\test\NewBrickBump.jpg", "myBump", , , , 30
On the object you want to add the bump mapping to do the following. We are using a Mesh called Teapot here.
Teapot.SetTextureEx TV_LAYER_BUMPMAP, GetTex("myBump") Teapot.SetTextureEx TV_LAYER_HEIGHTMAP, GetTex("myBump") Teapot.SetLightingMode TV_LIGHTING_OFFSETBUMPMAPPING_TANGENTSPACE
Offset Bumpmapping requires a Layer for HeightMap.
There are also 2 more type of bumpmapping.
Teapot.SetLightingMode TV_LIGHTING_BUMPMAPPING_OBJECTSPACETeapot.SetLightingMode TV_LIGHTING_BUMPMAPPING_TANGENTSPACE
There are 2 things you can do with Normal Mapping. They are described below.
To Generate a Normal map in TV you need 2 Mesh. One is the low poly that you will render and the other is the Hi-Poly version of the same mesh from which you will get all the details to put in the Low-Poly version.
Load your Low Poly mesh into a TVMesh (Teapot). Then create another mesh for the Hi-Poly (TeapotHi).
And then do.
Teapot.GenerateNormalMap TeapotHi, True, 1024, 1024, True
When you run your project it will take time for TV to generate the Map dependeing on the PolyCount of your Hi-Poly mesh. It may seem to be hanged up, but its not. It took me about 3mins for it to Generate on a 150k mesh.
You may then save this Normal Map by doing this:
TextureFactory.SaveTexture TextureFactory.GetTextureCount - 1, "test1.bmp"
To load a normal map in TV and set it use this:
TextureFactory.LoadTexture "test1.bmp", "myNorm" Teapot.SetTextureEx TV_TEXTURE_NORMALMAP, GetTex("myNorm") Teapot.SetLightingMode TV_LIGHTING_BUMPMAPPING_TANGENTSPACE
( No commenting on the model! )
First thing you need to use shaders, is to have one. You can download FX Composers. It has 136 Shaders ( .fx ) files in it for you to use, you can ofcourse also create your own. Note: The scene shaders in FX Composers does not work with TV as it uses special FX Composer specific instructions that are not in FX standards.
This is the declaration you need for your shader
Private myShader As TVShader
And then you will create your shader, set some parameters if you want. Here we are loading the Cartoon Shader from FX Composer and setting the Parameters to change the color. You may use FX Composer to look for these parameters.
Color is like a 4D Vector and this is the way TV treats them. So we create a TV_4DVector and set the color, and then change the preference on the shader.
Set myShader = Scene.CreateShader("NewShader") myShader.CreateFromEffectFile "D:\Program Files\NVIDIA Corporation\NVIDIA FX Composer\MEDIA\HLSL\Cartoon.fx" Dim test As TV_4DVECTOR test.x = 256 test.y = 0 test.z = 0 test.w = 0 myShader.SetEffectParamVector "diffuseMaterial", test
After we create the Shader, we want to apply it to something. And sometimes “SetMeshFormat 17” is required for particular shaders. For Cartoon Shader to work, the mesh can not have any texture. so SetTexture 0
Teapot.SetMeshFormat 17 Teapot.SetTexture 0 Teapot.SetShader myShader