Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: 1 ... 3 4 [5] 6
  Print  
Author Topic: Zak's Ocean Shader Freely Downloadable [6.5]  (Read 33474 times)
Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #80 on: February 13, 2007, 12:35:31 PM »

From the original post :
Quote
But I have one thing to ask you. Do not just take the shader and fit it in your app like a plug-in. There are TONS of customizations possible with the parameters, constants and compilation flags in the shader and in the code, play with them, adapt the shader to your tastes, or even better, learn HLSL and optimize it to your needs!!

The FPS difference with TV's water is very normal. This water does a lot of things TV's water doesn't do. You can customize it to improve the speed, but you'll never reach the same.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #81 on: February 13, 2007, 12:43:56 PM »

thanks for info zak.
i.a. water look GREAT !


and  my question : is possible how to set in TV6.5 clasics water  smaller reflection (default is like giant mirror) Sad
Logged

aiR Captains - RC aircraft project TV65
Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #82 on: February 13, 2007, 12:49:22 PM »

Sure, check out AGT's third person demo for an example of properly used TV water. It can look pretty good.
http://www.truevision3d.com/phpBB2/viewtopic.php?t=13697
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #83 on: February 13, 2007, 01:10:08 PM »

thanks... great.
Logged

aiR Captains - RC aircraft project TV65
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #84 on: February 13, 2007, 05:16:54 PM »

AGT' s water is good, bud not can set water collor , less reflections etc.

i simplify you watershader in C#  (run) and then retype to VB6 .. shader is create (in log), bud nothing showing .. nothing Sad

 
your  program.cs
Code:

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MTV3D65;

namespace Water {
    static class Program {
        static Viewport _viewport;
   
        static TVCamera _camera;
        static Settings _settings;

     
        static readonly string PATH_BASE = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf(@"\bin\"));
        static readonly string PATH_MEDIA = PATH_BASE + @"\Textures\";
        public static readonly string PATH_SHADERS = PATH_BASE + @"\Shaders\";

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            Initialize();
            Mainloop();
        }

        static void Initialize() {
            // Show an information getter
         
         
     

            // Fetch the infos
       

            // Do we want to continue?
            if (infoGetter.HasQuit) return;

            // Kill it
            infoGetter = null;

            // Init engine and viewport
            _viewport = new Viewport();
            Core.Initialize(_viewport, _settings);

            Core.Engine.SetSearchDirectory(PATH_MEDIA);

            // Init environment and water
            _camera = new TVCamera();
            Core.Engine.SetCamera(_camera);
            _camera.SetPosition(0, 60, 0);

            Water.InitWater();
        }

        static void InitEnvironment() {
         

        }

        static void Mainloop() {
            bool keepLooping = true;

            while (keepLooping) {
                Application.DoEvents();
                keepLooping = !Core.Inputs.IsKeyPressed(CONST_TV_KEY.TV_KEY_ESCAPE);

                Core.Engine.Clear();
                Water.RenderWater();
                Core.Engine.RenderToScreen();

            }
        }
    }
}




and  water.cs (i need only this two "source codes Huh?"

Code:


using System;
using System.Collections.Generic;
using System.Text;
using MTV3D65;

namespace Water {
    class Water {
        // Height of the water plane
     
        // Fix for reflection glitches where water hits the land
     

        static TVShader _waterShader;
        static TVRenderSurface _reflectRS;
        static TVMesh _water;


        public static void InitWater() {
            // Load related textures
            // Comment/uncomment the right texture depending on the method you use
            Core.TexFact.LoadVolumeTexture(@"Water\VolumeNormalMap.dds", "WaterVolume", CONST_TV_COLORKEY.TV_COLORKEY_USE_ALPHA_CHANNEL, true);
            //Core.TexFact.LoadTexture(@"Water\\NormalMap_DXT5NM.dds", "WaterDual");

            // Rendersurfaces init
            _reflectRS = Core.Scene.CreateRenderSurface(384, 384, true, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_X8R8G8B8);
         
            // Water init
            _water = Core.Scene.CreateMeshBuilder("Water");
            // The texture tiling of the grid defines how tiled the waves will be
            _water.AddFloorGrid(1, -5000, -5000, 5000, 5000, 32, 32, 50, 50, 50);
            _water.SetTextureEx(0, _reflectRS.GetTexture());

            // Comment/uncomment the right texture depending on the method you use
            _water.SetTextureEx(1, Core.Globals.GetTex("WaterVolume"));
            //_water.SetTextureEx(1, Core.Globals.GetTex("WaterDual"));

         

            _waterShader = Core.Scene.CreateShader("WaterShader");
            _waterShader.CreateFromEffectFile(Program.PATH_SHADERS + "WaterShader.fx");

            // Set the shader parameters
            _water.SetShader(_waterShader);

        }

     

        public static void RenderWater() {
            _water.Render();
        }
    }
}







and i retype this code to VB6


create water and shader
Code:


Private Sub init_water()
 
TextureFactory.LoadVolumeTexture "c:\VolumeNormalMap.dds", "watertex", TV_COLORKEY_USE_ALPHA_CHANNEL, True
Set RenderSurf1 = Scene.CreateRenderSurface(384, 384, True, TV_TEXTUREFORMAT_X8R8G8B8)
Set WaterMesh = Scene.CreateMeshBuilder
WaterMesh.AddFloorGrid 1, -5000, -5000, 5000, 5000, 32, 32, 50, 100, 50

WaterMesh.SetTextureEx 0, RenderSurf1.GetTexture()
WaterMesh.SetTextureEx 1, GetTex("watertex")

Set shader = Scene.CreateShader("shader")
shader.CreateFromEffectFile "c:\WaterShader.fx"
WaterMesh.SetShader GetShader("shader")
End Sub




main loop

Code:

Private Sub Main_Loop()
    Do
        DoEvents
       
        Check_Movement
       
        TV3D.Clear
     

     
         WaterMesh.Render

        TV3D.RenderToScreen
   
    Loop Until DoLoop = False
   
    ' We ask to quit.
    Main_Quit

End Sub




bud when run : nothing showing .... only black Sad

i can post here my source code if it helps.
Logged

aiR Captains - RC aircraft project TV65
Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #85 on: February 13, 2007, 05:52:04 PM »

First, yes you can set the water color with TV's built-in water with TVGraphicEffect.SetWaterReflectionColor.
Second, your code oversimplifies everything. And I'm not going to port it to VB6 at the moment, and neither will I help you doing it step by step, which it looks like you want me doing... So check your debug file, and good luck.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #86 on: February 14, 2007, 02:04:20 AM »

thanks for tip.

ad our water.
yes,i kick out ALL , bud water in C# run , the same i VB not ..... and debug file : your c# and my vb6 is Identical ..... shader created, no error , bud not Sad
Logged

aiR Captains - RC aircraft project TV65
sybixsus
Customers
Community Member
*****
Posts: 1088


WWW
« Reply #87 on: February 14, 2007, 08:56:21 AM »

If there's no error in the shader and you don't see anything, chances are that one of more of the textures is not being applied correctly.
Logged
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #88 on: February 14, 2007, 09:06:54 AM »

maybe .. bud all is only copied and converter to VB ....
i search error later.
now : can i set smaller water reflection (like 50% reflect , no 100%) in TV6.5 default water ? :-D
Logged

aiR Captains - RC aircraft project TV65
Hypnotron
Customers
Community Member
*****
Posts: 808


« Reply #89 on: March 04, 2007, 10:21:24 PM »

Make sure

1) you have the directional light in the scene
2) the texture paths within the FX file are properly pointing to the right locations.  

First time i tried getting this working i forgot to do this and i wasted half a day.  

Same thing happened to me just now as I incorped it into my new framework. Only this time i remembered after half an hour wasted  Cheesy
Logged
likedonuts
Customers
Community Member
*****
Posts: 246

Diesel connoisseur


« Reply #90 on: March 23, 2007, 04:46:01 AM »

Looks amazing, thanks or sharing!

Anyone has this poject in VC# 2003?  

/Mike
Logged

information is not wisdom, wisdom is not knowledge, knowledge is not truth, truth is not beauty, beauty is not love, love is not music, music is the best - Frank Zappa
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #91 on: July 07, 2007, 02:40:34 PM »

reupload od port to vb6 ?
Logged

aiR Captains - RC aircraft project TV65
Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #92 on: July 07, 2007, 03:03:40 PM »

Nope, no port for VB6. But I just updated the download link, and put up a new version of the sample too, it should be easier to convert now because the code is much cleaner.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #93 on: July 07, 2007, 03:07:13 PM »

Quote from: "Zaknafein"
Nope, no port for VB6. But I just updated the download link, and put up a new version of the sample too, it should be easier to convert now because the code is much cleaner.


thanks
Logged

aiR Captains - RC aircraft project TV65
Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #94 on: July 17, 2007, 12:09:45 PM »

hi,
if i download, install visual c# and try run get this error :


first :  the application for  project "c:\water\media\shaders\shaders.vcproj" is not installed
Warning   78   The referenced component 'MTV3D65' could not be found.    

any ideas ?
Logged

aiR Captains - RC aircraft project TV65
Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #95 on: July 17, 2007, 12:14:06 PM »

The vcproj error is nothing important, it's only because I compile the shaders from the Visual C++ IDE but it's not needed for the project to run; you can just remove the VC++ project from the solution.

The MTV3D65 error is because you need to re-reference the TV3D 6.5 DLL in the C# project. Delete the problematic reference and re-add it. Of course you need to be in the beta program...
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
JukkaKevät
Customers
Community Member
*****
Posts: 182


« Reply #96 on: August 16, 2007, 03:39:59 AM »

Hey I was just playing around with this shader and the vsleepy's underwater one. I noticed the evil issue when getting really close to the water plane (beneath the -5 fix) that the reflections disappear. The fix is there because the rendersurface "can't see inside the land" and thus renders the sky.

I fixed this by making landscape doublesided (disabled backface culling) for the duration of the reflection rendering. It didn't impact performance much and gives me the opportunity to get rid off the fix value. Now I have seamless transition to underwater.

Haven't tested on larger landscapes or more precise landscapes what the performance hit is. Just letting people know if they are struggling with the same issue.

... have to check how to apply the alpha map to get transparent shores...
« Last Edit: August 16, 2007, 03:44:30 AM by JukkaKevät » Logged
vsleepy
Customers
Community Member
*****
Posts: 245


« Reply #97 on: August 16, 2007, 04:39:17 AM »

can you see the water plane when you are under water? got a screen shot?
Logged
JukkaKevät
Customers
Community Member
*****
Posts: 182


« Reply #98 on: August 16, 2007, 05:09:40 AM »

The water plane is currently very bad if seen from underwater since it reflects the ocean bottom and doesn't catch any specular lighting, all the zaknafein's shader effects are calculated for nothing, so I'm creating another plane which is seen only from underwater and rotate couple of caustic textures on it.

I'll get you screenshots very soon if it works fine, I'll post them on your thread (these two could be merged into one Definitive Water Effects - thread  Grin

edit: I posted the shots on your shader thread
« Last Edit: August 17, 2007, 03:44:29 AM by JukkaKevät » Logged
nomadsoul
Customers
Community Member
*****
Posts: 113


« Reply #99 on: August 25, 2007, 10:36:26 AM »

hi, i try to turn zak hlsl code into vb.net, it hard work because i can't understand c language, but i have already done this :

For the moment the water doesn't look like zak water but i think i'am on the right way, i must change the reflection, and the water animation !

Thanks to you zak i begin to understand c language !  Grin
Logged
Pages: 1 ... 3 4 [5] 6
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks