Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: ShadowGen v1.0 Public Release  (Read 5024 times)
Toaster
Community Member
*
Posts: 378


WWW
« on: March 02, 2010, 09:29:43 PM »

ShadowGen v1.0 is here!

You can download the full version with examples here:
http://treegen.pipedreamgames.com/download.php?f=ShadowGen v1.0 Full Release.rar

or you can download the dll here:
http://treegen.pipedreamgames.com/download.php?f=ShadowGen v1.0 dll Release.rar

If you have any questions or comments please feel free to leave a comment here! Smiley

Screenshot of MiniMesh Shadows:
http://2.bp.blogspot.com/_qEAbtGGVpeM/S490jB4gyJI/AAAAAAAABl8/youY4KIvx8g/s1600-h/MiniMeshes.png

Thanks,
-Toaster
« Last Edit: March 04, 2010, 03:53:23 AM by Toaster » Logged

Visit my site at: Unknown Abstraction
TroM
Customers
Community Member
*****
Posts: 300


« Reply #1 on: March 02, 2010, 10:11:00 PM »

Yay for Toaster, ShadowGen rocks!  Tongue
Logged
DarekRuman
Customers
Community Member
*****
Posts: 184

game developer


WWW
« Reply #2 on: March 03, 2010, 06:41:56 AM »

I'm ready to help you with Delphi version. Just let me know.
Logged

www.reddotgames.pl
tv6.3 tv6.5 developer
games made in TV : Paintball Extreme, Reindeer Adventure, Mole : Great Adventure, Foxy Fox, Włatcy móch : Śnieżna Rozwałka, Włatcy Móch : Magiczni Wojownicy, Ski:), Lowrider Extreme
Gamecode
Customers
Community Member
*****
Posts: 467


WWW
« Reply #3 on: March 04, 2010, 03:43:29 PM »

i remove and then add shadowgen dll and now
Code:
Error 2 Reference required to assembly 'MTV3D65, Version=6.5.3602.42214, Culture=neutral, PublicKeyToken=50ecc2ceb76bb228' containing the type 'MTV3D65.TVEngine'. Add one to your project. C:\Users\short\Desktop\1112009\acnet\_Core.vb 363 9 aircaptains
Logged

aiR Captains - RC aircraft project TV65
Toaster
Community Member
*
Posts: 378


WWW
« Reply #4 on: March 04, 2010, 03:50:18 PM »

i remove and then add shadowgen dll and now
Code:
Error 2 Reference required to assembly 'MTV3D65, Version=6.5.3602.42214, Culture=neutral, PublicKeyToken=50ecc2ceb76bb228' containing the type 'MTV3D65.TVEngine'. Add one to your project. C:\Users\short\Desktop\1112009\acnet\_Core.vb 363 9 aircaptains

You need the latest TV dll. Smiley

-Toaster
Logged

Visit my site at: Unknown Abstraction
Gamecode
Customers
Community Member
*****
Posts: 467


WWW
« Reply #5 on: March 04, 2010, 03:55:33 PM »

is new tv ?

edit : no isnt new, but i have newest dll (compiled only for me) , and oficial ist older than have. Sad
« Last Edit: March 04, 2010, 04:00:59 PM by Gamecode » Logged

aiR Captains - RC aircraft project TV65
Toaster
Community Member
*
Posts: 378


WWW
« Reply #6 on: March 04, 2010, 04:25:36 PM »

If you send me your dll I'll compile shadowGen for you. You can email me at:

toasterthegamer@

and then its a gmail account so just add gmail.com.

-Toaster
Logged

Visit my site at: Unknown Abstraction
Celledor
Customers
Community Member
*****
Posts: 242


WWW
« Reply #7 on: March 19, 2010, 07:14:53 PM »

Sure looks cool, ran the examples and they work great so I tried to add it to a project of mine to test how it would work but some problems came up... on the ShadowGen.Update(); call I get an AccessViolationException telling I'm trying to read to protected memory, any ideas what could have gone wrong (probably something I have done).

If I remove the update everything is rendered black, but that might be because I have the light setup wrong.
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #8 on: March 19, 2010, 08:12:18 PM »

Sure looks cool, ran the examples and they work great so I tried to add it to a project of mine to test how it would work but some problems came up... on the ShadowGen.Update(); call I get an AccessViolationException telling I'm trying to read to protected memory, any ideas what could have gone wrong (probably something I have done).

If I remove the update everything is rendered black, but that might be because I have the light setup wrong.

Make sure you initialize everything correctly, and ShadowGen.Update() must be called. Make sure you have this somewhere in your initialization code:

Code:
            //Setup ShadowGen
            ShadowGenTV.TV = CEngine.TV;
            ShadowGenTV.Scene = CEngine.Scene;
            ShadowGenTV.Globals = CEngine.Globals;
            ShadowGenTV.ScreenFor2D = CEngine.ScreenFor2D;
            ShadowGenTV.Maths = CEngine.Maths;

            //Init ShadowGen
            ShadowGen = new ShadowGenEngine(ColorBuffer.GetTexture());

            //Create Directional Shadows
            ShadowGen.InitDirShadowMapping(1024, new TV_3DVECTOR(0.8f, -1, -0.5f), ShadowGenEngine.GaussianBlurMode.Tap5, 4);

Hope this helps!

-Toaster
Logged

Visit my site at: Unknown Abstraction
Celledor
Customers
Community Member
*****
Posts: 242


WWW
« Reply #9 on: March 22, 2010, 04:19:51 PM »

Quote
Make sure you initialize everything correctly, and ShadowGen.Update() must be called. Make sure you have this somewhere in your initialization code:

Hmm I checked by initializing code and found nothing wrong, if you want and have time I would apreiciate if you took a look at the code I use (just not sure what parts of it that is interesting to show, there is alot of it)... tried to take out the stuff about shadowgen.

First i declare it
Code:
        private Core            _core;
        private ShadowGenEngine _shadowGen;
        private TVRenderSurface _colorBuffer;

Than I initialize it
Code:
        public Form1()
        {
            InitializeComponent();
            InitializeGame();
            InitializeShadowGen();
            Focus();
        }

        private void InitializeShadowGen()
        {
            //Create Color Buffer
            _colorBuffer = _core.Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            _colorBuffer.SetNewCamera(_core.TV.GetCamera());

            //Setup ShadowGen
            ShadowGenTV.TV = _core.TV;
            ShadowGenTV.Scene = _core.Scene;
            ShadowGenTV.Globals = _core.Globals;
            ShadowGenTV.ScreenFor2D = _core.ScreenTv;
            ShadowGenTV.Maths = _core.MathLibrary;

            //Init ShadowGen
            _shadowGen = new ShadowGenEngine(_colorBuffer.GetTexture());

            //Create Directional Shadows
            _shadowGen.InitDirShadowMapping(1024, new TV_3DVECTOR(0.8f, -1, 0.5f), ShadowGenEngine.GaussianBlurMode.Tap17, 4);

            //Set Shadow Update Time
            _shadowGen.SetUpdateTime = 7;

            //Set Extra Distance this helps remove some of the artifcats on the mesh.
            _shadowGen.ShadowExtraDistance = 200;

            //Set the shadow's far plane
            //Exact same thing as the camera's far plane except for shadows.
            //This should be twice the size of your world.
            _shadowGen.ShadowFarPlane = 2000;

            //Set Shadow Alpha (this number is weird and you'll just have to play around wiht it to get good settings)
            _shadowGen.ShadowAlpha = 1.5f;

            _shadowGen.ShadowBias = 0.002f;
        }

// ...I load the map with the stuff that should cast shadows
Code:
        private void LoadMap()
        {
            if (_gameInfo.SelectedMap != "")
            {
                _mapHandler.LoadMap(_gamePath + "\\Maps\\" + _gameInfo.SelectedMap);
                _textureHandler.LoadLandscapeTextures(_gamePath, _mapHandler.GetCurrentMap());
                _materialHandler.LoadLandscapeMaterials(_gamePath, _mapHandler.GetCurrentMap());
                _lightHandler.LoadIngameLights(_mapHandler.GetCurrentMap());
                _lightHandler.SwitchToIngameLights();
                _landscapeHandler.Load(_mapHandler.GetCurrentMap(), _gameSettings, _textureHandler.TextureCollectionLandscape, _materialHandler.MaterialCollectionLandscape);
                _atmosphereHandler.LoadFog(_mapHandler.GetCurrentMap());
                _core.Scene.SetBackgroundColor(_mapHandler.GetCurrentMap().FogParameters.Color.r, _mapHandler.GetCurrentMap().FogParameters.Color.g, _mapHandler.GetCurrentMap().FogParameters.Color.b);
                _cameraHandler.InitCamera(new TV_3DVECTOR(0, 0, 0), Helper.ConvertGridPositionToPosition(_mapHandler.GetCurrentMap().StartUpPosition, false), new TV_3DVECTOR(0, 1.6f, 0), _mapHandler.GetCurrentMap().LandscapeWidth, _mapHandler.GetCurrentMap().LandscapeHeight, 150, 2, 800, 1500, 0.5f, 0.01f);
                _aiHandler.PlaceNodes(_mapHandler.GetCurrentMap(), _landscapeHandler);
                _aiHandler.GreateGraph(_mapHandler.GetCurrentMap(), _gamePath);
                _resetMainMenu = true;
                _structureHandler.LoadTemplates(_gamePath, _gameSettings.StartUpModFile, _core, _materialHandler);
                _structureHandler.LoadStartStructures(_gamePath, _mapHandler.GetCurrentMap(), _core, _materialHandler, _aiHandler, _gameSettings);
                _unitHandler.LoadTemplates(_gamePath, _gameSettings.StartUpModFile, _core, _materialHandler);
                _unitHandler.LoadStartUnits(_gamePath, _mapHandler.GetCurrentMap(), _core, _materialHandler, _aiHandler, _gameSettings);

                _shadowGen.AddTerrain(_landscapeHandler.Landscape, false);

                for (int i = 0; i < _structureHandler.StructureList.Count; i++)
                    _shadowGen.AddMesh(_structureHandler.StructureList[i].Model, false);

                for (int i = 0; i < _unitHandler.UnitList.Count; i++)
                    _shadowGen.AddMesh(_unitHandler.UnitList[i].Model, false);
            }
        }

// And finaly in the game loop I try to render it
Code:
        private void Draw3D()
        {
            // If we are in the main menu
            if (_gameState.ShowMainMenu)
            {
                //Code to render menu and background scenery has been removed
            }
            // We are in the game
            else
            {
                //Render to ColorBuffer
                _colorBuffer.StartRender(false);

                //Render landscape
                _landscapeHandler.Landscape.Render();

                //Render units, structures and obstacles
                _structureHandler.Render();
                _unitHandler.Render();
                _objectHandler.Render();

                _colorBuffer.EndRender();

                //Update Shadows
                _shadowGen.Update();

                _shadowGen.Render();
        }

Hoep you can see what I do wrong, would be really cool if I could use it for this project.
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #10 on: March 22, 2010, 04:49:05 PM »

You have your loop setup wrong. It needs to be like this(Pseudocode):

RenderColorBuffer

UpdateShadows

TV.Clear()

Render Everything With ShadowGen.Render()

draw2D stuff if you have any..

TV.RenderToScreen()

The main issue is that the colorbuffer render and ShadowGen.Update() needs to be outside of the TV.Clear() / TV.RenderToScreen()

Hope this helps! Smiley

-Toaster
Logged

Visit my site at: Unknown Abstraction
Celledor
Customers
Community Member
*****
Posts: 242


WWW
« Reply #11 on: March 22, 2010, 05:38:48 PM »

Thanks for answer, I moved stuff around but it didn't work so I for some reason moved the InitializeShadowGen(); to the LoadMap() and it works (sure I need to adjust a lot of settings but it works and seems fast to).

(See code)
Code:
private void LoadMap()
        {
            if (_gameInfo.SelectedMap != "")
            {
                _mapHandler.LoadMap(_gamePath + "\\Maps\\" + _gameInfo.SelectedMap);
                _textureHandler.LoadLandscapeTextures(_gamePath, _mapHandler.GetCurrentMap());
                _materialHandler.LoadLandscapeMaterials(_gamePath, _mapHandler.GetCurrentMap());
                _lightHandler.LoadIngameLights(_mapHandler.GetCurrentMap());
                _lightHandler.SwitchToIngameLights();
                _landscapeHandler.Load(_mapHandler.GetCurrentMap(), _gameSettings, _textureHandler.TextureCollectionLandscape, _materialHandler.MaterialCollectionLandscape);
                _atmosphereHandler.LoadFog(_mapHandler.GetCurrentMap());
                _core.Scene.SetBackgroundColor(_mapHandler.GetCurrentMap().FogParameters.Color.r, _mapHandler.GetCurrentMap().FogParameters.Color.g, _mapHandler.GetCurrentMap().FogParameters.Color.b);
                _cameraHandler.InitCamera(new TV_3DVECTOR(0, 0, 0), Helper.ConvertGridPositionToPosition(_mapHandler.GetCurrentMap().StartUpPosition, false), new TV_3DVECTOR(0, 1.6f, 0), _mapHandler.GetCurrentMap().LandscapeWidth, _mapHandler.GetCurrentMap().LandscapeHeight, 150, 2, 800, 1500, 0.5f, 0.01f);
                _aiHandler.PlaceNodes(_mapHandler.GetCurrentMap(), _landscapeHandler);
                _aiHandler.GreateGraph(_mapHandler.GetCurrentMap(), _gamePath);
                _resetMainMenu = true;
                _structureHandler.LoadTemplates(_gamePath, _gameSettings.StartUpModFile, _core, _materialHandler);
                _structureHandler.LoadStartStructures(_gamePath, _mapHandler.GetCurrentMap(), _core, _materialHandler, _aiHandler, _gameSettings);
                _unitHandler.LoadTemplates(_gamePath, _gameSettings.StartUpModFile, _core, _materialHandler);
                _unitHandler.LoadStartUnits(_gamePath, _mapHandler.GetCurrentMap(), _core, _materialHandler, _aiHandler, _gameSettings);

                InitializeShadowGen(); //<-----------------------------------

                _shadowGen.AddTerrain(_landscapeHandler.Landscape, false);

                for (int i = 0; i < _structureHandler.StructureList.Count; i++)
                    _shadowGen.AddMesh(_structureHandler.StructureList[i].Model, false);

                for (int i = 0; i < _unitHandler.UnitList.Count; i++)
                    _shadowGen.AddMesh(_unitHandler.UnitList[i].Model, false);
            }
        }


It might be because I change the camera and stuff based on the map that is loaded.
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #12 on: March 22, 2010, 05:51:41 PM »

Glad to hear it works Smiley I think you just need to call the InitializeShadowGen(); after you create TV with TV.InitEngine().

-Toaster
Logged

Visit my site at: Unknown Abstraction
Celledor
Customers
Community Member
*****
Posts: 242


WWW
« Reply #13 on: March 22, 2010, 05:59:31 PM »

Okej, now that I got it up and running I will play around with it... but a question. I noticed that fog and colors of things behaved oddly. Is this because I have the wrong adjustments or do I need to change things.
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #14 on: March 22, 2010, 07:17:05 PM »

Depends on how you mean oddly they should be the same, Although the shadows will probably appear ontop of the fog. I don't think I can fix that cause of how everything is setup to provided as much support for TV's built in shaders.

-Toaster
Logged

Visit my site at: Unknown Abstraction
GODDUEL
Customers
Community Member
*****
Posts: 10


« Reply #15 on: January 03, 2012, 04:15:47 AM »

Any way to work on Visual Basic 6.0? Cheesy
Logged
Toaster
Community Member
*
Posts: 378


WWW
« Reply #16 on: January 16, 2012, 08:15:25 AM »

I suppose I can upload the source if there are more people interested. I don't know if there is a way for you to use a C# dll inside of vb 6.0. that's a really old language.. However you should be able to convert the source from C# to vb 6.0.. That would require you knowing a bit of C# though.
Logged

Visit my site at: Unknown Abstraction
beyonder
Moderator
Community Member
*****
Posts: 445


« Reply #17 on: January 17, 2012, 04:02:43 PM »

I would be interested in a Vb6 solution too. I'm pretty good at C++ and C#. I could easily create an ActiveX version of the dll for use in VB6. I use VB6 too because it's easy to deploy - no framework needed.

Anyways Toaster, if you think it's too much of a pain to upload then don't worry about it. I've always been interested in a VB6 solution for this tho.

Alrighty, then.  Smiley
Logged

"And what I saw scared me to the depths of my miserable soul. It was true, it was all a sham, it ain't real." - The Thirteenth Floor
Toaster
Community Member
*
Posts: 378


WWW
« Reply #18 on: February 04, 2012, 06:21:46 PM »

I'll upload it soon stand by!
Logged

Visit my site at: Unknown Abstraction
Pages: [1]
  Print  
 
Jump to:  

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