Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Problem with evolved shaders

Author
Message
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 20th Sep 2014 06:27
I am trying to add some of evolved shaders to my game, the water effect worked fine, but i cant get the shadows mapping to work, if i try to apply the shadow to an object it just became all dark, with no shadows on it, the textures are all loaded correctly in all the 4 stages, i think i am messing up with the cameras:
in evolved examples he Always use a second camera called camera 1, but that is already used by my water shader, so i tryed to change the number of the camera to 3 (2 is used too by the water), my main problem is that i dont know how to deal with sync mask command, such as 2^0 or 2^1.
For a small example like just water shader or just shadow mapping shader its simple because its only 1 camera to mask, but if i already use 2 cameras for water, how do i have to deal with all the cameras? like i have to do sync mask 2^1 + 2^2 + 2^3? i am a bit confused as i tried something like this and nothing worked correctly, can someone help me on how to combine these 2 shaders (water and shadowmapping), without messing up with the cameras? seems i cant get them to work on the same game as they mess up with the cameras and i don t know how to handle the Whole thing
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Sep 2014 20:41
It's sounds like you are trying to extract just a couple of specific shaders to use individually outside of the larger system, this is doable but requires considerable effort.

The system is designed to be a unified framework, and allows you to configure which shaders and processes are loaded and used if you don't want to use all that it provides. Basically you shouldn't need to extract specific shaders, just configure the provided setup to only use what you want.

The shadow shaders depend on both his lighting shaders, and his light update processes, to get shadows working you would have to extract so much from the system you might as well just use the system.

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Sep 2014 21:01
I second what Ortu has said, just rem out the setup of parts you dont want to use and rem out any updating of those parts from the main loop, you will have to play around with this and do each part a bit at a time rather than attempt to do the whole lot at once ie rem out clouds setup and clouds update before moving on to other parts you dont want to use or you may well end up not getting exactly what you want. It will be worth it and will give you some understanding of how the system works.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Sep 2014 23:31 Edited at: 20th Sep 2014 23:36
You shouldn't even really need to REM out large portions.

If you don't want clouds, simply never call Clouds_Setup(). If this is not called, the cloud update processes will not run (other than maybe to check if clouds have been enabled)

If you don't want a dynamic sky, just don't call Sky_Create()

If you don't want bloom, or refraction, or SSAO, or whatever else set these to 0 in the call to PostProcessing_SetUp(ScreenWidth, ScreenHeight, D3DFormat, EnableRefraction, EnableDistorion, EnableSSAO, EnableScattering, EnableAA, EnableBloom, EnableDOF, EnableMotionBlur)

If you want less expensive shadows, you can alter the size of the shadowmap during the light setup: DirLight_Create(EnableSpecular, EnableSSAO, EnableShadowMode, ShadowMapSize) 512 is a pretty good midrange shadowmap, 1024 for sharp and detailed shadows, and 256 for basic fuzzy ones.

I know it is a pretty complicated mess, but it really is usefull to dig through the .dba code files to get an idea of how the system works, how the components fit together, and most importantly, what parameters the functions are actually working with. I even went to the trouble of creating a keywords file for syntax highlighting and function parameter prompting, though it is a version or two old and no longer accurate. It lacks all of the cloud functionality and several parameters have changed throughout the system. I've been meaning to get it updated...

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 21st Sep 2014 01:58
Quote: "You shouldn't even really need to REM out large portions"

um I wasn`t suggesting that, what I meant by saying
Quote: "...attempt to do the whole lot at once..."

was simply to do each part a bit at a time, the clouds being just 1 bit etc, the post filter setup iirc doesn`t need to be used at all if the OP doesn`t wish to use, so there are the lensflare lines that can be rem`d out which is 15 consecutive lines, I was thinking along those lines so that the OP doesn`t confuse him/herself, when I first started playing around with his older system(prior to the older previous one) thats how I learned what was what. In short the only remming required would be in the main source file which isn`t that big or complicated. As you had already covered most things I felt I should keep my post as short as possible, I merely wanted to encourage your point as sometimes its easier in ones mind to think that the route the OP has taken seems a lot easier. Once again I second everything you state in your second post. Also its worth mentioning the objects and effects that the OP wishes to add to the scene should be setup first by loading them, then by calling the object/effect_add functions from the object dba included, I mention this in case the OP does not realize this which may seem dumb, but yeah, in my early days I actually missed that LOL and spent an hour or so trying to work it out the hard way! I also wish to reiterate what you state about how comples it is as I would like to point out it only seems that way but as you said it is worth digging through all the code - once the OP has done this it will no longer seem so complex. In fact remming out the parts the OP doesn`t need is a doddle once the code is familiar to him/her. I would even have done it for him/her if it was not for the fact that the OP would perhaps feel no need to get familiar with the rest of the code - which in my mind is not an option, the OP would learn nothing from me doing that.
Ah yes the keyword file - I think you may have posted that once and I couldn`t beleive I hadn`t thought of such a simple thing! Worse still I forgot all about it with his new setup, I probably won`t do it though this time around as I feel I know enough of the code now to get along without it with ease, besides I`m just dumb enough to accidentally assume those are dbp commands in other projects
btw Ortu although Ive made no comment I am following your project, looks very promising indeed.
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 21st Sep 2014 02:11
OP doesn't say he's using advanced lighting, so I would assume he's using individual shaders; not trying to extract shaders from advanced lighting.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 21st Sep 2014 02:32
What i am doing is just taking the parts i need from evolved code (with the relative shader) and adding it to my game, i 1st added the water effect copying and maybe adapting it to my game, and it worked just fine, i also edited the water shader to get more waves instead of a clear plain water that reflect perfectly.
The problem is that i cant add other evolved shaders because all of them are made singularly so that they use camera 0 and 1 for example, but obviously if i add a new shader for example the shadowmapping one (to do the shadows of the characters for example) i cannot get them to work because they still use camera 0 and 1, and even if i try to change the camera number i dont know how to set the mask sync or camera sync commands properly.
I think anybody knows where to take the evolved shaders (Google evolved shaders and find his website), can someone help me to let work both water and shadowmapping shaders in the same code(and maybe the post processing effect, at least motion blur?), I didnt understood the replies i get so far, seems a bit confusing, people talking about clouds which i never mentioned and such, i only just want to understand how to use these shaders together and in particular if i am messing up with the camera things (which is what i suspect)

I remember you that what i did is not taking the WHOLE code wrote by evolved but JUST the parts required to let work the shaders, and in fact with the water i got everything perfectly.
So far with the attempt i did what a was getting applying the shadowmapping shader to my character (or other objects i tryed too) was getting him textured like dark, and doing this did f**ked up the water as well probably because of the camera mixing (because i dont know how to use sync mask 2^0 and such commands, dark basic help lack on info about a lot of things)
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 21st Sep 2014 02:40
let me make an example, this is the WHOLE shadowmapping code from evolved



and this is the part i just take



Obviously i have added the do loop part in my do loop one, and the other part before of it
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 21st Sep 2014 02:49
haha good point, thats what I get for skim reading! AL is sm3.0 and I ahvent downloaded his examples recently so maybe theyre not sm3.0 and OP does state "examples" in which case I would say if you can use sm3.0 use the AL sytem and rem out the few lines you need or perhaps the shader guru can step in here or anyone up to the task, Ive just finished painting so my head isnt in the right place, Ill also be decorating tommorrow so cant help then either :/ just a thought but I think it best the OP produce some code/media for anyone that may wish to help
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 21st Sep 2014 02:50
@James H, sorry man, I reread your post and see what you are saying now. I misread the part about the updates and thought you meant rem out the actual functions instead of just the calls to them. makes more sense now and I agree. and thanks for the WIP support!

@watty, you're right, I am making an assumption, but only because the great majority of evolveds shaders are built for and distributed in AL. if OP will clarify we may be able to help more.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 21st Sep 2014 20:32
@Cescano, if you're planning on using a lot of shaders, you might just want to use the advanced lighting system we've been mentioning. You can find that here: http://www.evolved-software.com/advancedlighting/advancedlighting
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 21st Sep 2014 22:20
I just need a water shader + shadowmapping shader + motion blur shader, i already know the link you gave me and it has a lot of files to open, they are not merged into 1 file, there is neither an executable to play to see how it would looks like
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 22nd Sep 2014 00:30
Quote: "i already know the link you gave me and it has a lot of files to open, they are not merged into 1 file, there is neither an executable to play to see how it would looks like"

In what way is this a problem for you?
Evolveds shaders are not for beginners and I have only just noticed your join date - are you new to DBPro? The fact you seem to require an executable to use worries me a lot! You only need to compile the project which is exceptionally simple - which leads me to my next point - how do you not know this while in the first post you clearly make alterations to existing projects? I am confused by this. Are you using DBPro or are you attempting to use the shaders outside of DBPro?
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2014 01:17
I am not new to dark basic, i started with classic like 10 years ago, then after 1-2 years i stopped and i just restarted 1-2 months ago, i also have some basic knowledge about c++ (very very basic, almost just basic syntax), i used to program in LSL in second life which is similar to C++ and i made a lot of stuff there which has been very helpful for the job i do there.

I asked for the executable because its a fast way to see how all looks like without having to open darkbasic and compile it (like all other shaders evolved did), seems that advanced lighting is the only shader he made without and exe, i have been able to look at the examples though running the code from darkbasic, but, they are several examples, not one that merge everything in the same file/project.

For example, you open cubemap dba and you see the object rotating with the shadow, that use only the cubemap thing not all the effects on the same file.

I have been able to use his water shader so i am not a noob, i know which part i have to copy into my code, the problem seems that i cant add more of his shaders due to the cameras, all examples use a second camera called 1, so if i try to add another shader the cameras will conflict.
I have looked at the code "advance lighting" but damn seems to be so long and complex to add just 4-5 effects to the game, 1 file only was 900 lines of code for example, i think that would be very heavy to add them all, i ve also tried to paste some of the code from advanced lighting into my project but i was getting errors like "cannot include xxx file", maybe a bug of the editor i dont know, i just changed editor now because i found a new one working in the cd box i bought from TGC (bonanza pack), the editor is updated 2008 while the one i was using was 2003, the 2010 one won t works on Windows 8.1 which i have.

By the way, can you make me an example on how to merge 2 or more evolved effects in the same code, for example, i am using the water shader, and i want to add shadowmapping shader to make the shadow for my character (which use bones, not limbs).
Understanding on how to merge the 2 shaders would let me get on how to add another one for example, the advanced lighting example is too much complex for the moment, it has a lot of filed and 1 rely to another so you cant take just 1 part for example


(the Whole thing would be a lot easier if darkbasic didn t had bugs, for example, today i tried to update to 7.7 and it fu**ed up my water, so i had to reinstall all and update up to 7.62 which works fine as i can see until now)
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd Sep 2014 01:50
The files don't need to be merged into one file, they are linked through the use of #INCLUDE and the compiler will get their contents as needed. The full AL system comes with quite a few sample projects which you can compile into an executable to test out with out needing any modification.

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 22nd Sep 2014 03:47
ok whats going on with the forum? The 2 posts dated 21st Sep 2014 07:32 and 21st Sep 2014 07:40(the ones sit between wattywatts 1st post and my 3rd post) did not show up at all until either after my last post or possibly the post I made before that as I simply may not have noticed the change before my last post! I know this for certain as I have read the thread several times over before I made the post dated 21st Sep 2014 07:49, after it became evident the OP was not using the AL system, you can see evidence of this as I state this at the end of my post:
Quote: " I think it best the OP produce some code/media for anyone that may wish to help"

As well as the fact that Ortu states at the end of his post after my 3rd post:
Quote: "if OP will clarify we may be able to help more."

Of course that info came before said post but simply did not show up.
Is post approval for new accounts 17 days? This cannot be the case surely - how was OP able to post in the first place if this was the case?
Over time I have noticed that quite often when I click to view the "Newest Post" option for some threads, I recieve a white page telling me there are no new posts and to either select to go back to the board or the first page of the thread AND for these very same threads I have noticed that the main board will show in the column on the far right that the latest post is detailed as the postee and date of said thread even though when I view the actual board in question has definately had newer threads posted in. Furthermore, on occasion, when I select "Newest Post" I sometimes get sent to the newest posts page rather than the page with the oldest of the newest posts! This is making confusing situations worse.
After noticing yesterday someone from sweden made a post 1 hour after me and the time was around 8pm uk time - the swedish posters posting time was around 6 to 7 hours ahead of me thus the date showed as the next day - should have been just 1 hour difference so I looked into it and the forum date and time has changed to match CEST in my profile. Im unsure what it was set to prior to this but I do know that I altered my time offset years ago correctly, but this has not been adjusted when CEST came into play. On my return to the forums in recent months posting times have been confusing me from time to time but didnt bug me enough until now. Now given all the above things are starting to make sense, surely TGC should have altered our profile offsets when they changed to match CEST? I wasnt even aware there had been a change to timezones!! After all why would I if I dont ever come across the need to know?

Ortu Can you confirm any of what I have just typed?

Cescano please excuse the confusion created, Im sure you will get the answers you seek in due course.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd Sep 2014 04:18 Edited at: 22nd Sep 2014 04:50
Those posts were not showing for me either I would guess he is still on new user post moderation I think a mod has to manually move him to normal non moderated status and i don't think it is auto time based period.

These new posts do confirm what I had suspected though and OP is trying to cut out just portions of the larger system. I will suggest again that he just use the system, but it also now seems that he doesn't fully understand how these shaders and #Include source files are meant to work together as a single unified system.

The issues with the camera numbers for instance: these shaders are intended to share cameras and renders in some cases and the system will create and manage cameras and renders internally as needed.

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Sep 2014 10:37
Quote: "ok whats going on with the forum?ok whats going on with the forum?"


Post moderation is a magic formula, it's not based merely on time. Mods approve them from a queue, but it all depends on when a mod logs on to do it.

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Sep 2014 23:19
Actually i asked for an example on how to combine 2 evolved shaders BUT not the advanced lighting ones, for example just the water shader and shadowmapping shader that he has separately, if you combine the 2 codes obviously they will not work, i need to know which changes i should made to the 2 codes so that i can add them to my game.

Please using normal shaders! the advanced lighting stuff has too much code to deal with and probably will be too heavy for the framerate, with too many files included and such, making an example with the normal shaders he use "water + shadowmap" will be a lot easier to understand

Login to post a reply

Server time is: 2026-07-18 07:31:30
Your offset time is: 2026-07-18 07:31:30