Fast Extend library — Thread 3

Blitz3D Forums/Blitz3D Userlibs/Fast Extend library — Thread 3

MikhailV(Posted 2008) [#1]
<- Previous topic

@Sph!nx: I'm not use PayPal, sorry... (Plimus only)


I bought Blitz3D SDK , and was wondering, when will the other libs, be available for this package. I am really interrested.


@LordShion: FastExt lib for Blitz3D only. It is very difficult to make such library for SDK, and demand very low.


MikhailV(Posted 2008) [#2]
And small demo for you from my friend MadMedic - Pseudo PSSM (shadow mapping). Please, test it... :)
It is required FastExt.dll (trial or retail), place dll nearby PSSM.exe


Naughty Alien(Posted 2008) [#3]
ohh..interesting..something i was crying for :)


Naughty Alien(Posted 2008) [#4]
..Mikhail..this just Plain B3D and fastExt?? Man...may I see source..please!...ahh


Sph!nx(Posted 2008) [#5]
Well, Plimus does use pay pal. The problem is, all of my email accounts gets rejected.

Gonna try one more email. If not, I will not be able to get the libraries... :-(


Thanks anyway, Mikhail!


EDIT :
Okay, I can probably use my brothers email to order this! Yay! :-D

Does Plimus also handles the email list for future updates or is that something you do yourself? If so, would you be able to change the email I use with purchase to my own?

TY!


Mortiis(Posted 2008) [#6]
OMG shadow mapping loook brilliant!

@Sph!nx

mikhail will give you a link, then you will be able to download your future updates there.


Sph!nx(Posted 2008) [#7]
Ah, I understand now! Thanks! Got a correct email now too, so I will order soon!


mongia2(Posted 2008) [#8]
good work!!!

for animate model??


MikhailV(Posted 2008) [#9]
..Mikhail..this just Plain B3D and fastExt?? Man...may I see source..please!...ahh

Yes, it's native B3D + FastExt. Sources — no, sorry, it's pre-alhpa demo without framework and optimizations, only for testing.

for animate model??

Animate model supported, but as caster only (not receiver). This problem can be solved in the future...


Naughty Alien(Posted 2008) [#10]
..uhh..cmon man..give it to me.. :) .. is it going to be part of next FastExt update so we can put our dirty hands on it or what?


Charrua(Posted 2008) [#11]
Hi to all

I'm totally new in this stuff!
so, where can I start?

Something to read, any a tutorial or doc?
I just want to improve blitz, I saw the demos and whatching and reading you, I'm totally lost!

I don't want to waste your time with fool's questions so,
I know that I have to read some (lot I think), but again, where to start??

thanks

Juan


Mortiis(Posted 2008) [#12]
You can start by downloading the trial version of FastExt and looking at examples. Then if you like it, you buy it. It's simple.


Charrua(Posted 2008) [#13]
Thank's

I did that!
But I ralize that I need some background to understand the whole thing.

Juan


MikhailV(Posted 2008) [#14]
New PSSM demo!
Also it is required FastExt.dll (trial or retail), place dll nearby PSSM.exe


_33(Posted 2008) [#15]
Seems to work fine, but I just get around 120 fps, and I have a ATI HD4850 card, which is latest generation mid/hi end card. So, performance doesn't seem to be great.


Mortiis(Posted 2008) [#16]
100 FPS here with a 8800 512mb but you have to add an option to hide blitz text for real results.


Naughty Alien(Posted 2008) [#17]
94FPS on nVidia 7600GT 256MB VRAM .. niceee .. selfshading over characters will be kicker..


MikhailV(Posted 2008) [#18]
For all: No need to hurry :) This is a syntetic test, acceleration of videocard not used (temporarily), whole work executes processor.


Barton(Posted 2008) [#19]
Nice :) Your FastLibs are revolution in b3d scene.
Where can I find the source code of ppssm3 ?


Mortiis(Posted 2008) [#20]
@Barton:
Sources — no, sorry, it's pre-alhpa demo without framework and optimizations, only for testing.



Naughty Alien(Posted 2008) [#21]
..Mikhail..regarding animated models, is it supported both MD2 and B3D??


Mortiis(Posted 2008) [#22]
Demo has B3D.


Naughty Alien(Posted 2008) [#23]
MD2 will be megacool..hundreds characters with ease with shadows and stuff..


Pinete(Posted 2008) [#24]
First time I can see this and looks amazing!!
Do you plan to release this as a new extension or as part of Fastext, Mikhail?
regards!,


MikhailV(Posted 2008) [#25]
It will be a FastExt part + a framework on a Blitz basic...
May be it will turn out nothing, you early ask such questions.


Pinete(Posted 2008) [#26]
amazing... do you have a date? :P
regards,


t3K|Mac(Posted 2008) [#27]
really cool!


t3K|Mac(Posted 2008) [#28]
i have found a bug in fastlibs:

DoF does only work when CameraViewport = Screen-/WindowResolution.
If you make a splitscreen using cameraviewport, all the DoF FX is gone.


Mortiis(Posted 2008) [#29]
When I use a resoultion lower than 800x600, I get strange artifacts like if post process layers are bigger than screen.


MikhailV(Posted 2008) [#30]

DoF does only work when CameraViewport = Screen/WindowResolution.


It's not bug! Viewport of the camera must have a size — width=GraphicsWidth() and height=GraphicsHeight() and use RenderPostprocess function after RenderWorld only for DOF postprocess fx. Whole two restrictions for correct work. This restrictions is connected with DirectX7, sorry.
If you want splitscreen - use CopyRectStretch function for resize.


When I use a resoultion lower than 800x600, I get strange artifacts like if post process layers are bigger than screen.


You can use other quality for Fx, which use blur.

quality% - blurring quality (values 0-3)
0 and 1 - fast method (0 - low quality, 1 - high quality) with artifacts on NVidia videocards
2 and 3 - slow method without any artifacts (2 - low quality, 3 - high quality)

edit: Other postprocess fx can't show artifacts.


puki(Posted 2008) [#31]
I find it strange that Plimus don't take payments that utilise AOL email addresses:
We do not accept email accounts from free email services such as hotmail.com, yahoo.com, etc



MikhailV(Posted 2008) [#32]
Hi!

Another PPSSM test (DirectX7!)



p.s. Thanks for my friend MadMedic :)

Radeon X700 Pro ~540 fps
Radeon HD7850 ~2400 fps!


Naughty Alien(Posted 2008) [#33]
..Mikhail, are you real? :) Is it safe..ahh..im paranoid :)


Tab(Posted 2008) [#34]
OMG D:

GF8800GT -> 880~1034 FPS


Mortiis(Posted 2008) [#35]
700-800 FPS
GF8800GT

Lovely.


Uber Jase(Posted 2008) [#36]
2100fps
8800Ultra SLI

Nice:D

So, looking at the dll, is it using dx9 or 7?


miez(Posted 2008) [#37]
520fps
GeForce 8800 GT


Mortiis(Posted 2008) [#38]
Wow, looks like 8800 is popular around here.


El Gigante de Yeso(Posted 2008) [#39]
Mikhail, wild guess:

Are you rendering the depthmaps from light POV and camera POV, and passing them to a DirectX9 context to process both through shaders and generate the resulting shadowmap? That's really genius, you ROCK so much, dude.

If not, please, explain in depth how are you doing this, because it's really interesting.


Mikele(Posted 2008) [#40]
Wow! 1600-1800 fps
GF 9800 GT


_33(Posted 2008) [#41]
1150-2000 fps
Radeon HD4850

The shadows look a bit blocky. Is there a way to change the resolution of the generated shadow so we get les jitter going on?


John Blackledge(Posted 2008) [#42]
What's supposed to be happening here?
I get a total white man and a totally white scene, on a black background.

Pentium4 1.60 Ghz 768MB Ram, Nvidia GeForce4 Ti4200, DirectX 9


ZJP(Posted 2008) [#43]
"..Mikhail, are you real? "
+1

970-980 fps
GF 9600 GT

JP


_33(Posted 2008) [#44]
John Blackledge: Your graphics card doesn't support direct X 9 (Geforce TI 4200)


John Blackledge(Posted 2009) [#45]
Oh yes it does. DirectX 9.0c running now.


_33(Posted 2009) [#46]
John Blackledge: The Geforce 4 TI series (7 year old GFX card) is a Direct X 8.0 card and does not support most Direct X 9 specific functionalities. This means that some stuff like Shaders model 2 or model 3 are not possible on your graphics card, and some other goodies which are reserved for more recent graphics cards. If you want those to work, you will need to upgrade to a more recent graphics cards, or just avoid TRYING to run Direct X 9 specific programs. It's not because the API is installed that your graphics card automatically gets upgraded. Some functions are simply not gonna run. That is why this demos does not work well on your system.


John Blackledge(Posted 2009) [#47]
_33 - understood, thanks.
But it does leave us with a problem.

Since it's well known that developers always use top-notch machines, and the rest of the public lag behind (I've yet to see even one PC in my neighbourhood which is newer than mine), that means that our potential market will be seeing white screens unless we detect which version of the graphics card/directx they are using.

Interestingly, one of the online game engines I saw recently gave me no water reflections, but worked fine on my friend's - obviously detected my card/dx version and compensated. - Better than getting a white screen.

My point is that any of the new dx9 dll's/systems should have this in as a function. Then the developer can choose what to enable for that particular user.


Mortiis(Posted 2009) [#48]
FastExt has a GfxDriverCaps variable so you can check the if the system has the technical needs.


_33(Posted 2009) [#49]
John Blackledge, you can do like Mortiis says and question the system with the GfxDriverCaps. You also have to understand that realtime shadows on a direct X 8 graphics card is not suggested (too slow). I suggest spending for a new card, and get up to speed with the newer technology.


John Blackledge(Posted 2009) [#50]
Agreed Mortiis, but _33 you're missing the point.

It's not what I (or my neighbours) are willing to do, it's about what programmers are willing to do to cope with older machines/cards.
- In the same way that we already cope with the user's selection or restriction of screen resolution.

A start-game message saying 'Some effects such as shadows and water reflection may not be visible on older graphics cards' would suffice.
As it was, the whole demo scene above rendered as completely white (no edges whatsoever) on a black background.


nrasool(Posted 2009) [#51]
One thing that confuses me, and kinda I'm leaning to John Blackledge side, is that the demo says "Another PPSSM test (DirectX7!)", therefore I would have imagined that the demo is using Directx 7 correct? Therefore, it shouldn't matter if the user has a graphic card which supports direct x 9.0c

Sorry if Im completely wrong, wouldn't be the 1st time ;-)


_33(Posted 2009) [#52]
MikhailV: Is it possible to alpha the shadow to say 0.5, and see how it looks? It isn't too natural to have shadows completely black. I would like to choose the level of alpha if I have to use this shadow capability of your lib. Also, the demo does say Direct X 7, which I think is not true since you're using a Direct X 9 api above it, no? Otherwise, I always like your work!!!


FlagDKT(Posted 2009) [#53]
nice 1850-2050 fps!
8800gt 512mb Quad6600 2gbRam
Windows XPsp3
Monitor CRT - 1024x768 85hz


ZJP(Posted 2009) [#54]
Woaa 1850-2050 fps with a 8800GT !!!
Maybe the core2quad !!!
JP


FlagDKT(Posted 2009) [#55]
I don't think so.
Quad used at 25% :)


ZJP(Posted 2009) [#56]
970-980 fps
GF 9600 GT
C2D E6600 at 40%, 3Go ram

JP

PS :
Uber Jase
2100fps
8800Ultra SLI !!!!!!!!

Mortiis
700-800 FPS !!!
GF8800GT

Tab
GF8800GT -> 880~1034 FPS

Your fps are incredible ;-)


Uber Jase(Posted 2009) [#57]
My fps was on a quad core qx6850 with vista 64. So maybe quads do make a difference.


ZJP(Posted 2009) [#58]
After an update of my video drivers ( Nvidia 181.20 ), I get
1850 FPS !!! WOAAA
50% CPU LOAD

JP

Edit :

2150 Fps after O/C with RivaTuner


MikhailV(Posted 2009) [#59]
Hi ppls!

Simple_Shadows_2.zip - the demo of the most simple shadows, based on FastExtension library (version 1.13 BETA for B3D 1.98-1.99).
Attention! FastExt.dll v1.13 for testing only, do not replace previous FastExt.dll (and decls-file) by this dll.

The given shadows has much "restrictions", but possess very high speed (only one additional RenderWorld for all casters, falling into radius of the action shadows) that gives him chance to be an used in real projects, as private event of the shadows.



p.s. This dll contain small bug (MAV in RenderWorld function), I can't find and fix If you will be able to find & show him on small example, I shall is much thanked for you and shall quickly create final version.

p.p.s. Work on advanced shadows (pseudo PPSM) is suspended. Many problems (with complex decision). Much complex system for introducing in real projects... :(


Mortiis(Posted 2009) [#60]
Could you please add the media files for the ones who would like to test or fix the problem please? (scene.b3d and such)


Pinete(Posted 2009) [#61]
I've tried it and it seems to me absolutely amazing. Great!. I've no words. :) It's very fast and I've not experienced any bug ;P
When do you plan a first release??
regards!


Naughty Alien(Posted 2009) [#62]
..hat down..this is most beautiful shadows I have seen in B3D yet..by the way, I noticed that characters are not receiving shadows...is it possible to set character or any other object on scene, to receive and cast shadows at same time??


MikhailV(Posted 2009) [#63]
Thanks for all!

@Mortiis: For a finding of a bug it is not required media files. My companions have made so - copied decls a file in the Blitz3D decls-folder (and used FastExt.dll v1.13 in the big project (game)). Have compiled it (without using shadows) and have received an MAV in RenderWorld() function :(

@Naughty Alien: The given shadows has much "restrictions" - not support self-shadowing and have other limitation, BUT very fast! All objects can receive and cast shadows (animated meshes, terrains and etc.)


Tab(Posted 2009) [#64]
Good enought for me with the receive & cast.

I did a test in my game and work perfect. :D


Mortiis(Posted 2009) [#65]
Can't wait for it to be finished...very very fast!


Naughty Alien(Posted 2009) [#66]
im seconding Mortiis..its really amazing and fast..that will absolutely cast some new shine on to B3D itself..


puki(Posted 2009) [#67]
"MikhailV" can you amend your contract with Plimus to allow AOL e-mail addresses to purchase?


puki(Posted 2009) [#68]
Or disable the feature then re-enable after I have purchased.

Apparantly, your default settings are set to block orders from free e-mail accounts - unfortunatley, this also kills AOL (which is a potentially huge ISP customer base) - this is due to AOL giving out free e-mail accounts.


MikhailV(Posted 2009) [#69]
@Mortiis & Naughty Alien: Please wait :) I need some more tests and create english help and comments for new functions. You can use current version of the library (temporarily of course).

@Puki: It is an old problem, I cannot influence it (already tried). You can address in support of company Plimus (as others)/ Sorry :(


Luis de la Cruz(Posted 2009) [#70]
Hello MikhailV,

First, good work. Shadows are very fast.

A question please. You say "All objects can receive and cast shadows (animated meshes, terrains and etc.)". Are you talking about heightmap terrains or only mesh terrain?


MikhailV(Posted 2009) [#71]
@Luis de la Cruz: I talking about heightmap terrains (native Blitz3D terrains). And any mesh of course. You can check it.


puki(Posted 2009) [#72]
"MikhailV" are you sure? My understanding is the sellers have control over this.

It's just that I notice other Plimus sellers are accepting AOL/free addresses - such as http://www.cubixstudio.com/Products.htm - Their order page will accept my AOL e-mail addresses.

Apparantly, the default setting is to forbid purchasers using free e-mail addresses; however, after you log into your Plimus account, can you amend this via 'Settings' and then under the 'General Settings' tab to 'Accept free domain orders' under 'Buy Now settings'. Then click 'Submit' and all free email addresses would be accepted.

I found that in Google; however, it may no longer be valid.

I re-mention this, just in case it solves the problem.


MikhailV(Posted 2009) [#73]
@puki: You are right, I did not know about such setting, excuse me. Now all should be good. Thanks!


Xaron(Posted 2009) [#74]
@MikhailV: That looks great! :)

When do you get that MAV? Tried to track it but I can't reproduce it...


puki(Posted 2009) [#75]
I'm like some kind of Plimus scientist - he'll probably get a lot more sales now.


MikhailV(Posted 2009) [#76]
@Xaron: read here - http://blitzbasic.com/Community/posts.php?topic=81671#943834


Xaron(Posted 2009) [#77]
MikhailV: What do you mean with "and used FastExt.dll v1.13 in the big project (game)"? What big game project shall I try? I thought you have some example code to reproduce this?


MikhailV(Posted 2009) [#78]
I not have example code, I cannot find a bug. Therefore also I ask to test dll on the big programs...


Xaron(Posted 2009) [#79]
Ah I see... Will do that. :)


Barton(Posted 2009) [#80]
@Mikhail: Have you tested your Shadow Sytem also on terrains/meshes with alpha map texture (mutitexture) ? Other Shadow Libs that I tested, doesn't work on multitexture Terrain or Meshes.


Tab(Posted 2009) [#81]
Tested in my "big" project without error.

Here a screenshot :D




SabataRH(Posted 2009) [#82]
I've also been unable to achieve an error, tested under several situations. 100 meshes, transparency surfaces and animated mesh.


MikhailV(Posted 2009) [#83]
@Barton: Shadow texture placed to last texture layer with 'multiply' blend. It should work fine on any models with any multitexturing.


MikhailV(Posted 2009) [#84]
The little advice - dynamic shadows is better for using only for dynamic objects, for all static — use classic lightmap! (if you use static light-source of course)


t3K|Mac(Posted 2009) [#85]
wow. amazing. i have also some cheap FSAA in b3d - with this shadowsystem, b3d is complete. cool. no need to wait for new engines...
thumbs up!!!!


Naughty Alien(Posted 2009) [#86]
..beautiful shot Tab..B3D is really rock with this lib..


t3K|Mac(Posted 2009) [#87]
i have wrong shadows with 2 testmodels... my playermodel itself works pretty fine with your demo source. but when i declare my own model as a shadow receiver i get ugly things like this:



whats wrong with my model?


MikhailV(Posted 2009) [#88]
@t3K|Mac: May be incorrect angle of light source (parallel with XZ plane)? Send your model to my email (support), i'm test it. Or place your model in my demo for testing.


t3K|Mac(Posted 2009) [#89]
Aha, i've set the shadowlight to point light - it seems it only works with directional lights.. is this true?


MikhailV(Posted 2009) [#90]
... it seems it only works with directional lights.. is this true?

Yes, you right. I will describe all restrictions in help-file for the Release version of library.

For point light-sources is required very difficult algorithm of a shadow-mapping based on cubemaps. It's unreal for DirectX7.


t3K|Mac(Posted 2009) [#91]
ok now it works... but the shadow looks pretty pixelated:

InitShadow 0



InitShadow 2




Any chance the get the shadow less pixelated? Mode 3 does not work on my new rig.


MikhailV(Posted 2009) [#92]
You should set ShadowRange for your scene, considering scale of your scene! As example: ShadowRange 5 (or 10-15).

The shadow extends on the area set in this ShadowRange parametre (concerning the Camera). It is More area (ShadowRange), it is more pixelate effect.


t3K|Mac(Posted 2009) [#93]
aaah, ok, good to know. btw. i love this addition!!! very nice!


t3K|Mac(Posted 2009) [#94]
i have another question:

the shadow seems a little bit offset. is this adjustable?




MikhailV(Posted 2009) [#95]
Probably, your model is above, than red surface (floor). Foots must is found on floor, rather then midair...


t3K|Mac(Posted 2009) [#96]
its on the ground - if i set it deeper it gets clipped by the floor.


MikhailV(Posted 2009) [#97]
Sebd me surces and media files, I solve this problem.


ZJP(Posted 2009) [#98]
..with this shadowsystem, b3d is complete. cool. no need to wait for new engines...

With THIS LIB, B3D is complete. +1000
My last wish: Use pixel shader (HLSL) with textures/images buffers. After that, I do not ask anything

JP


t3K|Mac(Posted 2009) [#99]
@Mikhail: Mail sent.


puki(Posted 2009) [#100]
If I buy this thing, then how much free media comes with it?


ZJP(Posted 2009) [#101]
@t3K. I like your motion capture ;-)

JP
http://www.t3k-entertainment.com/showscreen.php?id=20


MikhailV(Posted 2009) [#102]
@t3K|Mac: Check your mail!

@puki: All media from trial version (it's identical with retail version).


t3K|Mac(Posted 2009) [#103]
Nice work! With the new shadowoffset command it works pretty fine!


puki(Posted 2009) [#104]
My mother wants to know why it is not fully documented in English.


Tab(Posted 2009) [#105]
I think i have found a bug...

With the new version when i use the SetCubeAlign onto a texture and i use it, B3D gives a MAV in the renderworld function.


MikhailV(Posted 2009) [#106]
@puki: All functions, which are intended for users, are documented. The exception - new functions from v1.13, wait for it to be finished.

@Tab: Fine, I soon fix this!


puki(Posted 2009) [#107]
All functions, which are intended for users, are documented

Mother informs me that they are not all documented in English. Mother thinks that more than half of the FastImage library are in Russian.


MikhailV(Posted 2009) [#108]
@puki: :) Your mother mistaken. Help file (FastImage_Help_Eng.txt ) included all functions. Possible she sees commentary in examples in russian, but this does not pertain to subject. I repeat - all functions are documented and you can check this (consider amount a functions in files FastImage_Help_Eng.txt and FastImage_Help_Rus.txt).


puki(Posted 2009) [#109]
Yes, she is referring to the code examples.

Some are documented in English only - some are in Russian only - some are in both Russian and English.

Father is unhappy at the lack of continuity.


MikhailV(Posted 2009) [#110]
@puki: Ok, I shall do it in next version.


John Blackledge(Posted 2009) [#111]
Mikhail, don't let Puki wind you up.
He's well known for his hunger for 'media', so he's just continuing a standing joke.

To everyone else, I bought the Fast libs, and they are a standard part of my libraries now. I must admit I have barely touched the surface due to lack of time for development, but if I end up only ever using FastText then it was still worth the cost.


Pinete(Posted 2009) [#112]
Thanks to Mikhail Blitz will live some years more... His libraries are absolutely essentials.
Regards!


RifRaf(Posted 2009) [#113]
I've purchased your libs.. and sent you an email to your support@fastlibs address as well. The zips you have for download for the full versions of all the libraries are invalid and cannot be openened.


Luis de la Cruz(Posted 2009) [#114]
Here a first test with simple shadows in a heightmap terrain (native Blitz3D terrains). Shadows works ok. I'm working this shadows in "Sword Fighters" but I have some problems yet.




RifRaf(Posted 2009) [#115]
Just curious if anyone else recently purchased the 3 in one pack, at its reduced price. The Zip download linked from the publisher is corrupt for me, i've redownloaded it the max times allowed by the server. corrupt each time.


puki(Posted 2009) [#116]
He's probably still fixing the documentation in the code examples.


MikhailV(Posted 2009) [#117]
@RifRaf: Don't panic, check your e-mail.


ardee(Posted 2009) [#118]
Just a heads up as I haven't seen this elsewhere but on my system the libs do not work with Blitz3D 1.100, I had to downgrade to 1.99 for the .bb samples to compile in the "simple_shadows_2.zip" demo (otherwise a MAV) or the Fastlibs demos (Runtime Exception). Everything works fine on precompiled demos though.

Great work though.


RifRaf(Posted 2009) [#119]
yeah, i was aware of the 1.99 thing as well.

MikhailV, hey sorry I wasnt in a panic. Just wanted to make sure you were aware so I could get a proper download.

Thank you.


MikhailV(Posted 2009) [#120]
1.13 beta 2 - simple_shadows_4.zip

- compatible with Blitz3D 1.100, 1.99, 1.98
- MAV bug fixed for function SetCubeAlign
- new functions ShadowOffset, ShadowFade and example Test_FadeOut.bb for testing

@ardee: you can update decls-file and fastext.dll from last demo and use in Blitz3D 1.100, but I do not recommend (temporarily) while library on stage of the testing.

@RifRaf: Thanks for you. This blame of Plimus servers, but I guilty in total.


ardee(Posted 2009) [#121]
@MikhailV

Thanks for the update about v1.100, will be buying this lib now. Love the shadow fadeout feature.


MikhailV(Posted 2009) [#122]
Little about restrictions of the shadows. Two pictures below show to you, as will fall shadow on receivers.



First picture demonstrate simple indoor scene (as receiver) and two casters inwardly.
Projection of the shadow spreads on whole receiver (front and back faces!).
In such event follows to exclude left wall and ceiling from reception of the shadow (not to fix these objects as receivers).




Second picture demonstrate that shadows can fall through on receiver (similarly - spreads on whole receiver).
This it is necessary to take into account when making scene
(separate objects on several parts, where one part can be a receiver, but other not)




This picture demonstrate, that wrong to place part of the caster (or whole caster) inside receiver.
Such situation it is necessary to avoid.


MikhailV(Posted 2009) [#123]
Also - simple shadows not support self-shadowing, and support directional lights only.
If you want to have less problems, that see drawing below:



Use good angles for light-source (used for shadows).


t3K|Mac(Posted 2009) [#124]
@MikhailV: Thanks for the fade command. very nice!!!


puki(Posted 2009) [#125]
What happens when the light is put inside a room? Problem 2 should be fine with dynamic receivers. Problem 3 probably will not always occur and the back shadow might be minimal anyway. The worst observation I had when poking the exe was that you can get a double shadow going in opposite directions.

Other than that, I think it all does what it says on the tin and is a simple, fast, solution with minimal problems.


MikhailV(Posted 2009) [#126]
@puki:

It is impossible create universal and absolutely suitable system.
Universal system <> fast system. More universal and simple - more slow. For DirectX7 and Blitz3D possible only fast system, to was possible use it in real games and projects.

I conducted experiments with more complex system of the shadows (pseudo PPSM) - for this necessary 3-4 RenderWorld whole geometries scene for each frame! And necessary global material system (advanced brushes) - this is not present in Blitz3D and create such in Blitz3D nearly unrealistic. In total such system not applicable in real projects and games.


Mortiis(Posted 2009) [#127]
Hey, got any news Mikhail? How is it coming along, are we going to have the full version anytime soon? thanks!


MikhailV(Posted 2009) [#128]
@Mortiis: In progress, please wait... :)


RifRaf(Posted 2009) [#129]
MikhailV, have you ever tried to create an Edge Preserving Smooth filter for the library? I could really use that. :)

heres an example of this filter applied in PsP8.0.

Before Filter..
http://www.empowergames.com/standard.jpg?
After Filter..
Http://www.empowergames.com/toonedup.jpg?


MikhailV(Posted 2009) [#130]
I think - it's impossible on DirectX7, without shaders :(


ZJP(Posted 2009) [#131]
No?
It's a post-process effect!!! As yours. ;-)
http://www.webdesign.org/web/raster-graphics/paint-shop-pro/edge-preserving-smooth.3740.html

http://www.eurasip.org/Proceedings/Eusipco/Eusipco2008/papers/1569104877.pdf
JP


El Gigante de Yeso(Posted 2009) [#132]
Yeah, but this post-process effect requires direct pixel manipulation wich is only achieved through pixel shaders. The post-process effects in the FastExt lib are achieved through blended blits of the screen, and there's no direct pixel manipulation at all.


MikhailV(Posted 2009) [#133]
@El Gigante de Yeso: Yes, you right!


ZJP(Posted 2009) [#134]
Ok ;)

JP

Edit : It is possible to mix the screen with a fixed texture?. ;-)


MikhailV(Posted 2009) [#135]
@ZJP: Yes, in v1.13
CustomPostprocessOverlay alpha, blend, red, green, blue, yourTexture
RenderPostprocess FE_Overlay



ZJP(Posted 2009) [#136]
Shadows and this. Very good news. You have a new customer. ;-)

JP


KronosUK(Posted 2009) [#137]
Would Fastextension work with minib3d?


Dreamora(Posted 2009) [#138]
No, its DX7 and minib3d is strictly OpenGL


Santiworld(Posted 2009) [#139]
hi, i recently i buyed the fastext, is realy excelent..


i have my first problem... the menu 3d of the game, run perfect, in the race, work perfect, but when i go back to menu, the program crash..
i use the example code of all post process

in debug i found this values

Error : memoryacces violation
function renderpostprocess....

my values, are
flags = 223
x = 0
y = 0
with = 0
heigh = 0

shurely i made something wrong in my game.

regards...


MikhailV(Posted 2009) [#140]
Use SetBuffer BackBuffer() before RenderPostprocess function for this flags ( = 223 ). It should solve a problem. And read restrictions for RenderPostprocess function in help-file.


Santiworld(Posted 2009) [#141]
thanks, is realy amazing how works this in the game...

i going to read the help now :p


Mortiis(Posted 2009) [#142]
Mikhail, how is the new update going? Any release dates? :) I'm tired of that trial version msg box every 5 minutes :)


MikhailV(Posted 2009) [#143]
:) tomorrow!


puki(Posted 2009) [#144]
What happens tomorrow?


Mortiis(Posted 2009) [#145]
Release date is tomorrow? :D great! I couldn't keep my mouth shut for one more day :P


MikhailV(Posted 2009) [#146]
FastExtension v1.13 library released!
Try it - http://fastlibs.com/libraries.php#fastextension

v1.13
- added projective shadows system
- added new examples - ShadowsSimple_Demo.bb, ShadowsSimple_FadeOut.bb, ShadowsSimple_NoiseBlur.bb, ShadowsMultiple_Demo.bb, ShadowsMultiple_FadeOut.bb, ShadowsMultiple_NoiseBlur.bb, ShadowsMultiple_TrickForPlatformers.bb
- added new simple postprocess effect "Overlay" + example FastExt_PostprocessOverlay.bb
- do not forget update dll, decls, include files!

p.s. Customers - check your personal account.

*EDIT: And read help-files please! :)


Naughty Alien(Posted 2009) [#147]
..great..im going to check my stuff ;)


miez(Posted 2009) [#148]
Absolutely stunning, as usual. Thanks Mikhail!


Tab(Posted 2009) [#149]
Simply amazing. =)


Dreamora(Posted 2009) [#150]
Great additions Mikhail


puki(Posted 2009) [#151]
I hope you fixed the comments in the example source as mother is checking it right now.

I am going to test it out as this thing is probably worth buying with the shadows included.


RifRaf(Posted 2009) [#152]
Love it.. Will take some creative level design to get things perfect. but definatly the best real time shadows ive used in blitz3d. On my rig, low detail works pretty fast, anything above that is too slow.


ZJP(Posted 2009) [#153]
New customer ;-)
25$!!!. VERY VERY good price for FastCompleteSet. Thx

JP


Doiron(Posted 2009) [#154]
It works like a charm, and it also fixed the issue with the latest version of B3D. Thanks, Mikhail!


nrasool(Posted 2009) [#155]
Nice Update Mikhail, this is very impressive, run the demos, and its great. Very fast as well, I don't know what else you could include into this. Very good plugins.

@Doiron, What issue is that with B3D then, just out of interest?


Doiron(Posted 2009) [#156]
Previous versions of FastExt didn't run on Blitz3D V1.10: FastExt v1.13 fixed that.


Pinete(Posted 2009) [#157]
Superb! thank you very much Mikhail!


Uber Jase(Posted 2009) [#158]
Awesome update:D Thanks:)

Could self shadowing be done using some kind of trick using 2 versions of a mesh? Or any oher way?


MikhailV(Posted 2009) [#159]
Excuse me, it's impossible, 2 versions of a mesh will not help.
You can separate mesh asunder, but this not comfortable for developing.


Mike0101(Posted 2009) [#160]
Very good and really fast extension. Thank you Mikhail. Today I was buy the Fastimage lib too. I think this will be big help for developing.

Do you have plan for something blur or soft edge for shadow?


_33(Posted 2009) [#161]
Thank you MikhailV for these additions!


El Gigante de Yeso(Posted 2009) [#162]
Do you want blurred shadow? You can use the post process effects for this: All you need to do is set the buffer to the shadow texture and apply an effect before doing the final renderworld.
UpdateShadows(Camera)
SetBuffer(TextureBuffer(ShadowTexture))
    RenderPostprocess(FE_Blur)
SetBuffer(BackBuffer())
RenderWorld()

Of course, you'll have to tweak the blur parameters to get it nicely done, but this is pretty much what you need.


puki(Posted 2009) [#163]
I bet I can make it self-shadow.


Mike0101(Posted 2009) [#164]
El Gigante: Good idea, thank you


Mike0101(Posted 2009) [#165]
With your mother?


Mortiis(Posted 2009) [#166]
Great piece of code, and offering it free for the fastExt owners is the most generous!


Ian Thompson(Posted 2009) [#167]
Sorry to be a bit OT but if a 3rd party can inject a hook and add these features, why did BRL say that this was not possible all these years? :(


RifRaf(Posted 2009) [#168]
Well, as nice as it is. Its a bit resticting in how you can use it. Just my own thoughts, but perhaps BRL did not want to release a "hacked" shadow system. I wouldnt want to release somthing in a fully working system, that could only be used under certain restrictions. Its great for 3rd party, but as part of B3D, can you imagine the forum complaints.


MikhailV(Posted 2009) [#169]
@Ian Thompson:
It is possible for a long time is provided in DirectX7. That it to create, is necessary a lot of work and time (and a flexible mind).

There can be a BRL has no free time to develop a Blitz3D 2.0. I will be glad - if all possibilities of my library are built in the Blitz3D engine (even is ready to give source files to main developer).

In any case, create additional libraries it is good work, the engine is improved. Any universal engine cannot be fast. For various situations additional completion is required.

Write the letter to Mark, persuade him to upgrade Blitz3D, and all will be happy!


Mike0101(Posted 2009) [#170]
This is the solution, Mikhail let's develop the Blitz3D 2.0 (Dx9) in full time!
I have a problem with the shadow system. In close quarter (room, corridor) the shadow is on the floor and on the ceiling too.


RifRaf(Posted 2009) [#171]
Mike look at the illustration images above in this thread they explain that issue. You have to split your ceiling into seperate entity and do not set it as a receiver it seems.


Mike0101(Posted 2009) [#172]
Thank you, I'm blind:)


ZJP(Posted 2009) [#173]
"...Sorry to be a bit OT but if a 3rd party can inject a hook and add these features, why did BRL say that this was not possible all these years? :( ..."


:-(

"...Well, as nice as it is. Its a bit resticting in how you can use it. Just my own thoughts, but perhaps BRL did not want to release a "hacked" shadow system. I wouldnt want to release somthing in a fully working system, that could only be used under certain restrictions. Its great for 3rd party, but as part of B3D, can you imagine the forum complaints..."


Complaints?!?.

From a 3rd party it's a "sort of hack" but from BRL would have been official. A normal development. :-)

JP


Mike0101(Posted 2009) [#174]
I'm playing with new shadow system and i think it's great. Fast, flexible enought. A real deal in Blitz3D. My upcoming game will be better with this feature.


Mike0101(Posted 2009) [#175]
How can I modify the blur level? I'm using the blur for the shadow with this method and the shadow changes for too blur?

SetBuffer(TextureBuffer(ShadowTexture))
RenderPostprocess(FE_Blur)
SetBuffer(BackBuffer())


MikhailV(Posted 2009) [#176]
Please, read help file, CustomPostprocessBlur function.


Mike0101(Posted 2009) [#177]
Ok, I was read and everything is clear


Mortiis(Posted 2009) [#178]
I have a problem, adding the shadow texture to a pre lightmapped 3D world studio map, I get this color tone problems. What would you advice me to fix this?




MikhailV(Posted 2009) [#179]
@Mortiis: Wrong blend or you use not last empty texture layer for shadow map?. Send me an source code, I will solve a problem.


Mike0101(Posted 2009) [#180]
I have problem with freetexture command. I think something collisions with the original freetexture command.


MikhailV(Posted 2009) [#181]
@Mike0101: Please, create small example with your problem.


Mike0101(Posted 2009) [#182]
Ok


RifRaf(Posted 2009) [#183]
Mike, just fyi you do not have to manually free shadowtextures, or fadeout textures.. When you call the FreeShadows() function it does this for you, and if you free them before you call freeshadow, or after. you will get a MAV.


Mike0101(Posted 2009) [#184]
Entity doesn't cast shadow when the entityautofade is setting. Is this true?


MikhailV(Posted 2009) [#185]
@Mike0101: I have checked, you right. Set maximum autofade values (near and far = 99999) for entity before UpdateShadows function, and restore after. I fix it in next version of the library.


Mike0101(Posted 2009) [#186]
Cool! Thank you


RifRaf(Posted 2009) [#187]
EDIT: Nevermind. had an issue but I got around it.


Mortiis(Posted 2009) [#188]
Wrong blend or you use not last empty texture layer for shadow map?. Send me an source code, I will solve a problem.


thanks, I was applying the shadow to the last texture layer but apparently I confused the layer of diffuse and lightmapping textures. Moved the lightmapping texture to layer 0 and everything is fine now.


Mike0101(Posted 2009) [#189]
How can I use a low poly copy of the original meshes as casters?
I would like to load and render the shadow by the lowpoly mesh but it must be hiding or alpha=0 but in this case doesn't cast shadow.
other:
Hideshadowcaster and hideentity are same? (In view of shadow performace)


FlagDKT(Posted 2009) [#190]
..and how to cast a simple shadow circle on the ground?


El Gigante de Yeso(Posted 2009) [#191]
I didn't try it out, but the solution seems very logical:
- Hide original mesh
- Show the lowpoly one / show the sphere mesh in case for FlagDKT
- Update shadows
- Hide the lowpoly / sphere
- Show the original mesh
- RenderWorld


FlagDKT(Posted 2009) [#192]
Fast library are so fast...why slowdown with such methods?
It would be enough to cast a custom texture.
Much better and fast for casual games I think.
What do you think MikhailV ? :)


t3K|Mac(Posted 2009) [#193]
i'd like to have that as a fallback solution (for slower machines). would be a nice addition.


MikhailV(Posted 2009) [#194]
@FlagDKT: You can change (do corrections) source file ShadowsMultiple.bb or ShadowsSimple.bb for your necessity. First - hide low-poly mesh, and create caster from it mesh.
See function UpdateShadows and insert your code in loop:
;
; attach all casters to shadow-pivot
;
For j = 0 To Shadow\castersCount-1
	i = Shadow\casters[j]
	i\attached = 0
	If i\enabled<>0 Then
		If EntityInView( i\entity, ShadowCameraDefault ) Then
			i\parent = GetParent( i\entity )
			EntityParent  i\entity, ShadowPivotDefault, 1
;
; ... your code here, as example:
;
;			PositionEntity i\entity, EntityX(i\highpoly,1), EntityY(i\highpoly,1), EntityZ(i\highpoly,1), 1
; 			ShowEntity i\entity


			i\attached = 1
		EndIf			
	EndIf
Next


and

;
; restore, detach all casters from shadow-pivot and attach to real parent	
;	
For j = 0 To Shadow\castersCount-1
	i = Shadow\casters[j]
	If i\attached<>0 Then
;
; ... your code here, as example:
;
;		HideEntity i\entity
;
		EntityParent  i\entity, i\parent, 1
		Endif
	i\attached = 0
Next


and add new field in caster Type:
Type ShadowCaster
	Field entity%
	Field highpoly%         ; <<<<< new field
	Field enabled%
	Field parent%
	Field attached%
End Type


I think that you has understood principle. You may change source-file such, as better for you.

p.s. you can use simple sprite (for simple circle shadow) as caster for high-poly mesh!

p.p.s. I can improve shadow system for you, if it difficult for you.


FlagDKT(Posted 2009) [#195]
More things to modify than expected :)

in ShadowsSimple.bb :
Type ShadowCaster
	Field entity%
	Field realEntity%	;only when cast dummies used
	Field enabled%
	Field parent%
	Field attached%
End Type


Function FreeShadows% ()
	Local Shadow.Shadow, i%
	
	Shadow = ShadowDefault
	If Shadow\texture<>0 Then
		SetBuffer TextureBuffer(Shadow\texture)
			Color 255, 255, 255
			Rect 0, 0, Shadow\texSize, Shadow\texSize,1
		SetBuffer BackBuffer()
		TextureBlend Shadow\texture, Shadow\texBlend And $FFFF
		TextureIndex Shadow\texture, 0
		FreeTexture Shadow\texture
	EndIf
	
	For s.ShadowCaster=Each ShadowCaster
		If s\realEntity>0 Then FreeEntity s\entity
	Next
	
	If ShadowLightDefault<>0 Then
		FreeEntity ShadowLightDefault
		ShadowLightDefault = 0
	EndIf
	If ShadowCameraDefault<>0 Then
		FreeEntity ShadowCameraDefault
		ShadowCameraDefault = 0
	EndIf
	If ShadowPivotDefault<>0 Then
		FreeEntity ShadowPivotDefault
		ShadowPivotDefault = 0
	EndIf
	SetBuffer BackBuffer()
End Function


Function UpdateShadows% (camera%, tween#=1.0)
	Local j%, i.ShadowCaster, fog%, blend%, t#, Shadow.Shadow
	
	HideEntity camera
	Shadow = ShadowDefault

	If ShadowCameraDefault<>0 And ShadowPivotDefault<>0 And Shadow\enabled<>0 And Shadow\light<>0 And Shadow\texture<>0 Then
		ShowEntity ShadowCameraDefault
		ShowEntity ShadowPivotDefault
		;
		; shadow-camera A.I.
		;
		PositionEntity ShadowCameraDefault, EntityX(camera,1), EntityY(camera,1), EntityZ(camera,1), 1
		RotateEntity ShadowCameraDefault, EntityPitch(Shadow\light,1), EntityYaw(Shadow\light,1), EntityRoll(Shadow\light,1), 1
		MoveEntity ShadowCameraDefault, 0, 0,  -Shadow\range / Tan ( Shadow\cameraFov / 2.0 )
		;
		; attach all casters to shadow-pivot
		;
		For i = Each ShadowCaster
			i\attached = 0
			If i\enabled<>0 Then
				If EntityInView( i\entity, ShadowCameraDefault ) Then
					i\parent = GetParent( i\entity )
					EntityParent  i\entity, ShadowPivotDefault, 1
					
					If i\realEntity>0 Then
						EntityAlpha i\realEntity,0	;this way a Hidden entity will remain hidden
						ShowEntity i\entity																				;**
						PositionEntity i\entity, EntityX(i\realEntity,1), EntityY(i\realEntity,1), EntityZ(i\realEntity,1), 1	;**
					EndIf
					
					i\attached = 1
				EndIf			
			EndIf
		Next
		;
		; render shadow-pivot (all casters)
		;
		fog = FogMode(1)
		TextureBlend Shadow\texture, Shadow\texBlend And $FFFF
		;
		If Shadow\mode<>0 Then
			SetBuffer TextureBuffer(Shadow\texture)
		Else
			SetBuffer BackBuffer()
		EndIf
		
			CameraViewport ShadowCameraDefault, 0, 0, Shadow\texSize, Shadow\texSize
			ClsColor 255, 255, 255 : Cls 1,0
			CameraFogColor ShadowCameraDefault, Shadow\powerR * Shadow\power, Shadow\powerG * Shadow\power, Shadow\powerB * Shadow\power
			RenderEntity ShadowPivotDefault, ShadowCameraDefault, 1, tween
			
			SetViewMatrixCurrent 0
			CopyProjMatrix ShadowMatrix
				ShadowMatrix\m41 = ShadowMatrix\m41 + Shadow\offsetX
				ShadowMatrix\m42 = ShadowMatrix\m42 + Shadow\offsetY
				ShadowMatrix\m43 = ShadowMatrix\m43 + Shadow\offsetZ
			SetProjMatrix 0, ShadowMatrix
			
				If Shadow\fadeTexture<>0
					CustomPostprocessOverlay 1, 0, 255, 255, 255, Shadow\fadeTexture
					RenderPostprocess FE_Overlay
				EndIf
	
				; rect for debug
				;	Color 0,0,0
				;	Rect Shadow\texSize/4,Shadow\texSize/4,Shadow\texSize/2,Shadow\texSize/2,0
				;	Rect 1,1,Shadow\texSize-2,Shadow\texSize-2,0
	
				Color 255,255,255
				Rect 0, 0, Shadow\texSize, Shadow\texSize,0
				
			If Shadow\mode<>0 Then
				SetBuffer BackBuffer()
			Else
				CopyRect 0,0, Shadow\texSize,Shadow\texSize, 0,0, BackBuffer(), TextureBuffer(Shadow\texture)
			EndIf
			;
			TextureBlend Shadow\texture, Shadow\texBlend
			FogMode fog
			;
			; restore, detach all casters from shadow-pivot and attach to real parent	
			;	
			For i = Each ShadowCaster
				If i\attached<>0 Then 
					EntityParent  i\entity, i\parent, 1
					
					If i\realEntity>0 Then
						EntityAlpha i\realEntity,1
						HideEntity i\entity
					EndIf
					
					i\attached = 0
				EndIf
			Next
			HideEntity ShadowPivotDefault
			HideEntity ShadowCameraDefault
		Else
			If Shadow\texture<>0 Then
				SetBuffer TextureBuffer(Shadow\texture)
					Color 255, 255, 255
					Rect 0, 0, Shadow\texSize, Shadow\texSize,1
				SetBuffer BackBuffer()
			EndIf
		EndIf

	ShowEntity camera
End Function


Function CreateShadowCaster% (caster_entity%,castDummy=0)
	Local i.ShadowCaster, class$
	If caster_entity<>0 Then
		class = EntityClass(caster_entity)
		If class<>"Pivot" And class<>"Light" And class<>"Camera" And class<>"Mirror" And class<>"Listener" Then
			For i = Each ShadowCaster
				If i\entity=caster_entity Or i\realEntity=caster_entity Then Return 0
			Next
			i = New ShadowCaster
			If castDummy=0 Then
				i\entity = caster_entity
			Else
				i\entity = castDummy
				i\realEntity=caster_entity;
			EndIf
			i\enabled = 1
			Return 1
		EndIf		
	EndIf
	Return 0	
End Function


Function ShowShadowCaster% (caster_entity%)
	Local i.ShadowCaster, tmp%
	If caster_entity<>0 Then
		f = 0
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then ShowEntity i\entity
				tmp = i\enabled
				i\enabled = 1
				Return tmp
			EndIf
		Next
	EndIf
	Return 0
End Function


Function HideShadowCaster% (caster_entity%)
	Local i.ShadowCaster, tmp%
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then HideEntity i\entity
				tmp = i\enabled
				i\enabled = 0
				Return tmp
			EndIf
		Next
	EndIf
	Return 0
End Function


Function FreeShadowCaster% (caster_entity%)
	Local i.ShadowCaster
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then FreeEntity i\entity
				Delete i
				Return 1
			EndIf
		Next
	EndIf
	Return 0
End Function


Function FindShadowCaster% (caster_entity%)
	Local i.ShadowCaster
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then Return 1
		Next
	EndIf
	Return -1
End Function


Now you could init shadows like this:
castDummy=CreateSphere();<--It could be a sprite or something else
CreateShadowCaster caster,castDummy

or in the classic way.

Have I done well? :)

Edit:made some corrections. Copy again :)


Mike0101(Posted 2009) [#196]
Compliment! I will test


RifRaf(Posted 2009) [#197]
Should make that same mod in shadowsmultiple.bb


FlagDKT(Posted 2009) [#198]
ok in shadowsmultiple.bb :

Type ShadowCaster
	Field entity%
	Field realEntity%
	Field enabled%
	Field parent%
	Field attached%
End Type


Function FreeShadows% ()
	Local Shadow.Shadow, i%
	
	Shadow = ShadowDefault
	If Shadow\texture<>0 Then
		SetBuffer TextureBuffer(Shadow\texture)
			Color 255, 255, 255
			Rect 0, 0, Shadow\texSize, Shadow\texSize,1
		SetBuffer BackBuffer()
		TextureBlend Shadow\texture, Shadow\texBlend And $FFFF
		TextureIndex Shadow\texture, 0
		FreeTexture Shadow\texture
	EndIf
	
	For s.ShadowCaster=Each ShadowCaster
		If s\realEntity>0 Then FreeEntity s\entity
	Next
	
	If ShadowLightDefault<>0 Then
		FreeEntity ShadowLightDefault
		ShadowLightDefault = 0
	EndIf
	If ShadowCameraDefault<>0 Then
		FreeEntity ShadowCameraDefault
		ShadowCameraDefault = 0
	EndIf
	If ShadowPivotDefault<>0 Then
		FreeEntity ShadowPivotDefault
		ShadowPivotDefault = 0
	EndIf
	SetBuffer BackBuffer()
End Function


Function UpdateShadows% (camera%, tween#=1.0)
	Local j%, i.ShadowCaster, fog%, blend%, t#, Shadow.Shadow
	
	HideEntity camera
	Shadow = ShadowDefault

	If ShadowCameraDefault<>0 And ShadowPivotDefault<>0 And Shadow\enabled<>0 And Shadow\light<>0 And Shadow\texture<>0 Then
		ShowEntity ShadowCameraDefault
		ShowEntity ShadowPivotDefault
		;
		; shadow-camera A.I.
		;
		PositionEntity ShadowCameraDefault, EntityX(camera,1), EntityY(camera,1), EntityZ(camera,1), 1
		RotateEntity ShadowCameraDefault, EntityPitch(Shadow\light,1), EntityYaw(Shadow\light,1), EntityRoll(Shadow\light,1), 1
		MoveEntity ShadowCameraDefault, 0, 0,  -Shadow\range / Tan ( Shadow\cameraFov / 2.0 )
		;
		; attach all casters to shadow-pivot
		;
		For i = Each ShadowCaster
			i\attached = 0
			If i\enabled<>0 Then
				If EntityInView( i\entity, ShadowCameraDefault ) Then
					i\parent = GetParent( i\entity )
					EntityParent  i\entity, ShadowPivotDefault, 1
					
					If i\realEntity>0 Then
						EntityAlpha i\realEntity,0	;this way a Hidden entity would remain hidden
						ShowEntity i\entity																				;**
						PositionEntity i\entity, EntityX(i\realEntity,1), EntityY(i\realEntity,1), EntityZ(i\realEntity,1), 1	;**
					EndIf
					
					i\attached = 1
				EndIf			
			EndIf
		Next
		;
		; render shadow-pivot (all casters)
		;
		fog = FogMode(1)
		TextureBlend Shadow\texture, Shadow\texBlend And $FFFF
		;
		If Shadow\mode<>0 Then
			SetBuffer TextureBuffer(Shadow\texture)
		Else
			SetBuffer BackBuffer()
		EndIf
		
			CameraViewport ShadowCameraDefault, 0, 0, Shadow\texSize, Shadow\texSize
			ClsColor 255, 255, 255 : Cls 1,0
			CameraFogColor ShadowCameraDefault, Shadow\powerR * Shadow\power, Shadow\powerG * Shadow\power, Shadow\powerB * Shadow\power
			RenderEntity ShadowPivotDefault, ShadowCameraDefault, 1, tween
			
			SetViewMatrixCurrent 0
			CopyProjMatrix ShadowMatrix
				ShadowMatrix\m41 = ShadowMatrix\m41 + Shadow\offsetX
				ShadowMatrix\m42 = ShadowMatrix\m42 + Shadow\offsetY
				ShadowMatrix\m43 = ShadowMatrix\m43 + Shadow\offsetZ
			SetProjMatrix 0, ShadowMatrix
			
				If Shadow\fadeTexture<>0
					CustomPostprocessOverlay 1, 0, 255, 255, 255, Shadow\fadeTexture
					RenderPostprocess FE_Overlay
				EndIf
	
				; rect for debug
				;	Color 0,0,0
				;	Rect Shadow\texSize/4,Shadow\texSize/4,Shadow\texSize/2,Shadow\texSize/2,0
				;	Rect 1,1,Shadow\texSize-2,Shadow\texSize-2,0
	
				Color 255,255,255
				Rect 0, 0, Shadow\texSize, Shadow\texSize,0
				
			If Shadow\mode<>0 Then
				SetBuffer BackBuffer()
			Else
				CopyRect 0,0, Shadow\texSize,Shadow\texSize, 0,0, BackBuffer(), TextureBuffer(Shadow\texture)
			EndIf
			;
			TextureBlend Shadow\texture, Shadow\texBlend
			FogMode fog
			;
			; restore, detach all casters from shadow-pivot and attach to real parent	
			;	
			For i = Each ShadowCaster
				If i\attached<>0 Then 
					EntityParent  i\entity, i\parent, 1
					
					If i\realEntity>0 Then
						EntityAlpha i\realEntity,1
						HideEntity i\entity
					EndIf
					
					i\attached = 0
				EndIf
			Next
			HideEntity ShadowPivotDefault
			HideEntity ShadowCameraDefault
		Else
			If Shadow\texture<>0 Then
				SetBuffer TextureBuffer(Shadow\texture)
					Color 255, 255, 255
					Rect 0, 0, Shadow\texSize, Shadow\texSize,1
				SetBuffer BackBuffer()
			EndIf
		EndIf

	ShowEntity camera
End Function


Function CreateShadowCaster% (caster_entity%,castDummy=0)
	Local i.ShadowCaster, class$
	If caster_entity<>0 Then
		class = EntityClass(caster_entity)
		If class<>"Pivot" And class<>"Light" And class<>"Camera" And class<>"Mirror" And class<>"Listener" Then
			For i = Each ShadowCaster
				If i\entity=caster_entity Or i\realEntity=caster_entity Then Return 0
			Next
			i = New ShadowCaster
			If castDummy=0 Then
				i\entity = caster_entity
			Else
				i\entity = castDummy
				i\realEntity=caster_entity;
			EndIf
			i\enabled = 1
			Return 1
		EndIf		
	EndIf
	Return 0	
End Function


Function ShowShadowCaster% (caster_entity%)
	Local i.ShadowCaster, tmp%
	If caster_entity<>0 Then
		f = 0
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then ShowEntity i\entity
				tmp = i\enabled
				i\enabled = 1
				Return tmp
			EndIf
		Next
	EndIf
	Return 0
End Function


Function HideShadowCaster% (caster_entity%)
	Local i.ShadowCaster, tmp%
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then HideEntity i\entity
				tmp = i\enabled
				i\enabled = 0
				Return tmp
			EndIf
		Next
	EndIf
	Return 0
End Function


Function FreeShadowCaster% (caster_entity%)
	Local i.ShadowCaster
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then
				If i\realEntity>0 Then FreeEntity i\entity
				Delete i
				Return 1
			EndIf
		Next
	EndIf
	Return 0
End Function


Function FindShadowCaster% (caster_entity%)
	Local i.ShadowCaster
	If caster_entity<>0 Then
		For i = Each ShadowCaster
			If i\entity=caster_entity Or i\realEntity=caster_entity Then Return 1
		Next
	EndIf
	Return -1
End Function


It should work :)
Lemme know!

p.s.made some corrections in shadowsimple.bb in the previous post.


Mike0101(Posted 2009) [#199]
I'm using simpleshadow.bb and I can say your version with the lowpoly caster is brilliant. Works very well. Thank you


DreamLoader(Posted 2009) [#200]
hi there,i just boght a copy of fast complete lib, my main language is
bmax,i wonder if there will be a fastExt for blitz3d sdk???


Uber Jase(Posted 2009) [#201]
You all probably know this but for thoose that may not...

You can get a nice framerate boost with water by rendering to the water texture every 2nd frame instead of every frame. I cant notice the visual difference but I guess some might:)


ardee(Posted 2009) [#202]
@MikhailV

When using render tweening for timing I'm getting a "jerky" shadow texture from moving entities. Is this a known limitation?


MikhailV(Posted 2009) [#203]
@ardee: You tried to set tween# parametre in UpdateShadows function?
from help-file:
UpdateShadows% (camera%, tween#=1.0)
tween# - use for tweening, analogue tween param from RenderWorld


ardee(Posted 2009) [#204]
@MikhailV

No, I'm just using Mark's Render Tweening code from his castle demo, everything works OK except the shadow seems to move indepentantly.

I will try and post some code showing this later. I'd be most grateful if you could take a look.


RifRaf(Posted 2009) [#205]
Im using tweening, shadows move fine if you do not input a tween value in the call to updateshadows(), why would you if you are already tweening rendering states elsewhere.


ardee(Posted 2009) [#206]
@MikhailV

Please see code below showing the issue I have with Shadows flickering or moving when render tweening is applied. Comment out tween# from Renderworld and the shadow displays and moves as expected (but with no smooth render tweening at 60fps obviously)

Include "FastExt.bb"
Include "ShadowSimple.bb"

Graphics3D 1280,1024,0,2
initExt

Const fps=60
HidePointer()

InitShadow 2		
ShadowRange 80		
ShadowPower 0.4		
ShadowColor 180, 200, 255	
stex = ShadowTexture()		

lp = CreatePivot()
l=CreateLight(1,lp)
AmbientLight 64,64,64
TurnEntity l,60,0,0
TurnEntity lp,0,180,0


ShadowLight l	

camera = CreateCamera()
MoveEntity camera,0,30,-10


; Build Car
F_Axel = CreatePivot()
R_Axel = CreatePivot()
F_Bumper = CreatePivot()

RL_Wheel = CreateWheel(R_Axel)
RR_Wheel = CreateWheel(R_Axel)
FL_Wheel = CreateWheel(F_Bumper)
FR_Wheel = CreateWheel(F_Bumper)
Body = CreateCube(R_Axel)
CreateShadowCaster  body		
EntityColor body,255,50,0
ScaleEntity body,2,1,4
PositionEntity body,0,2,2.5

MoveEntity RL_wheel,-2,0,0
MoveEntity RR_wheel,2,0,0
MoveEntity FL_wheel,-2,0,0
MoveEntity FR_wheel,2,0,0
MoveEntity r_axel,0,0,-5
EntityParent F_Bumper,R_Axel

speed# = 0
drift# = 0
steer# = 0


; Build Ground
Ground = CreatePlane()
i = CreateImage(64,64)
SetBuffer(ImageBuffer(i))
Color 0,0,255:Rect 0,0,32,32:Rect 32,32,32,32
Color 0,100,255:Rect 32,0,32,32:Rect 0,32,32,32
checker = CreateTexture(64,64)
CopyRect 0,0,64,64,0,0,ImageBuffer(i),TextureBuffer(checker )
FreeImage i
ScaleTexture checker ,50,50
EntityTexture ground,checker 
PositionEntity ground,0,-1,0
EntityTexture ground,stex,0,2	
SetBuffer BackBuffer()

period=1000/fps
time=MilliSecs()-period

Repeat
	
	
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed
	
	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld
		
		
	; Steering
		If KeyDown(205)Then steer = steer + 1
		If KeyDown(203) Then steer = steer - 1
		steer = steer * 0.5	
	; turn the wheels
	RotateEntity f_axel,0,EntityYaw(r_axel)-steer,0
	RotateEntity FL_Wheel,0,EntityYaw(r_axel,True)-(steer*10),0,True
	RotateEntity FR_Wheel,0,EntityYaw(r_axel,True)-(steer*10),0,True	
	; gas
	If KeyDown(200) Then speed = speed + .2
	speed = speed * .94	
	; forwards
	MoveEntity f_axel,0,0,speed
	PointEntity r_axel,f_axel
	MoveEntity r_axel,0,0,EntityDistance(r_axel,f_axel)-5 ;5 is the car length
	; drift
	drift = drift + (steer * speed) * -.01
	drift = drift * .95
	MoveEntity f_axel,drift,0,0
	MoveEntity r_axel,drift*1.1,0,0
	PointEntity r_axel,f_axel
	MoveEntity r_axel,0,0,EntityDistance(r_axel,f_axel)-5 ;5 is the car length	
	; roll body
	RotateEntity body,0,0,-drift*10	
	; update cam
	PointEntity Camera, F_Bumper
	PositionEntity camera,EntityX(r_axel),30,EntityZ(r_axel)-50
	
	
	UpdateWorld
Next

	UpdateShadow camera	
	RenderWorld tween#
	
	Flip
	
Until KeyHit(1)

Function CreateWheel(Parent)
	Entity = CreateCylinder(12,0,Parent)
	RotateMesh Entity,90,90,0
	ScaleMesh Entity,.5,1,1
	EntityFX entity,16
	EntityColor entity,50,50,50
	Return Entity
End Function




Mike0101(Posted 2009) [#207]
This is the right main loop




Vorderman(Posted 2009) [#208]
I hope this set of libs are good - I've been using some old version of fasttext for ages and it's been great, so I've just purchased the full retail set as I paricularly want to try out the shadow stuff!


ardee(Posted 2009) [#209]
@Mike0101
Doh! Thanks for pointing that out, works perfectly now :-)

@MikhailV
Will be purchasing the full set of libs soon, thanks for this great resource.


MikhailV(Posted 2009) [#210]
I am glad! Thanks!


Naughty Alien(Posted 2009) [#211]
..okay Mikhail..now new request (you know, I always ask all this things, same as for shadows and stuff ;)) .. is there any way to somehow include in your library ability to do hardware skinning over animated meshes so we can have some decent number of characters at same time without FPS loss?? That will be awesome feature..


ZJP(Posted 2009) [#212]
Ah. It's time wishes?. Always looking for an example to this with Fastext ( in real time, of course ;-) ):



Pinete(Posted 2009) [#213]
I Agree with Naughty Alien, that would be something impressive, no doubt!
long time ago, I don't remember the name, someone upload a small example just to have a great number of animated characters without loss of speed, that was really cool!, the problem was he doesn't supply a library, just a executable & .bb hardcoded example impossible to work with..

That kind of adition could be perfecly great!

regards!,


Naughty Alien(Posted 2009) [#214]
..yes Pinete..thats true..if I remember correctly, it was GrumpyOldMan who use to post that impressive example... I wish B3D has capability to do hardware skinning...so much things will be possible to do with B3D (animation issue was only reason why I pushed away my game from B3D since I have some quite large scenes with characters)..Im sure Mikhail can do it :)


FlagDKT(Posted 2009) [#215]
And ..what about cell/cartoon shading :D ?


Mike0101(Posted 2009) [#216]
A fast, efficency cell shading system would be great.


Naughty Alien(Posted 2009) [#217]
..cell shading system with flexible options will be a great add on..but again, i still do believe, most critical part of B3D is animation system..its really killing frame rate rapidly...I mean..i was able to render beautiful scenes with B3D with around 230K polys with no problems, over 35 FPS on 6600GT..but, put few characters on scene, and your FPS is gone..so, if you ask me, this priority should be skinning and then anything else (just because of performance impact)... :) but lets hear what Mikhail going to say :)


RifRaf(Posted 2009) [#218]
i vote toon shading! :)


FlagDKT(Posted 2009) [#219]
Imho
Fastlibs operate just on the rendering part, customizing the output, without interfere with blitz3d functions.
I think that modifying animation system would require the blitz3d source code.(just think about how many blitz functions use vertex data)
We really should ask to blitz3d creators the reason why the system is so slow.
btw it would be great to integrate a faster version of skin engine.


ZJP(Posted 2009) [#220]
"...Fastlibs operate just on the rendering part, customizing the output, without interfere with blitz3d functions..."
Maybe.

I think that modifying animation system would require the blitz3d source code.
Or Blitz3D SDK source?

..just think about how many blitz functions use vertex data...
Possible ;-)
Here a source from the Russian Blitz site - (c)ANDREYman- :
http://forum.boolean.name/showthread.php?t=1843
http://andreyman.ucoz.ru/publ/1-1-0-1

DLL ( DevCPP )
//andreyman.ucoz.ru
//(c)ANDREYman

#include <windows.h>     
#include <stdio.h>

#define BBDECL extern "C" _declspec(dllexport)
#define BBCALL _stdcall


typedef struct _BBVERTEX
{
     float x,y,z;
     float nx,ny,nz;
     char a,r,g,b;
     float u0,v0;
     float u1,v1;
     char i1,i2,i3,i4;
     float w1,w2,w3,w4;

} BBVERTEX, *LPBBVERTEX;

/*
typedef struct _BBTRIANGE
{
         unsigned short a,b,c;

} BBTRIANGE, *LPBBTRIANGE;
*/
BBDECL void TransformSurfaceToMatrix( unsigned int *surfaceSrc, unsigned int *surfaceDest, float *Entity )
{
LPBBVERTEX SrcVertexBuffer, DestVertexBuffer ;

float x,y,z;

//Ãëîáàëüíàÿ ìàòðèöà:
float	EMatrix11= *(Entity+44);
float	EMatrix12= *(Entity+45);
float	EMatrix13= *(Entity+46);

float	EMatrix21= *(Entity+47);
float	EMatrix22= *(Entity+48);
float	EMatrix23= *(Entity+49);

float	EMatrix31= *(Entity+50);
float	EMatrix32= *(Entity+51);
float	EMatrix33= *(Entity+52);

float	EMatrix41= *(Entity+53);
float	EMatrix42= *(Entity+54);
float	EMatrix43= *(Entity+55);

SrcVertexBuffer	 = (struct _BBVERTEX *)*(surfaceSrc+7); //Àäðåñ íà÷àëà âåðøèííîãî áóôåðà èñõîäíîé ñåòêè
DestVertexBuffer = (struct _BBVERTEX *)*(surfaceDest+7); //Àäðåñ íà÷àëà âåðøèííîãî áóôåðà òðàíñôîðìèðóåìîé ñåòêè

*(surfaceDest+16)=0; //Îáíóëåíèå ýòîãî ôëàãà îçíà÷àåò èçìåíåíèå âåðòåêñ áóôåðà, ïîñëå ÷åãî îí áóäåò ïåðåäàí âèäåîêàðòå

int VertexCount = ( *(surfaceSrc+8) - *(surfaceSrc+7) )/64;//(VertBufEnd-VertBufStart)/64; //Êîëè÷åñòâî âåðøèí â ñåòêå

for (int vertex = 0; vertex<VertexCount; vertex++)
  {
	x=SrcVertexBuffer[vertex].x;
	y=SrcVertexBuffer[vertex].y;
	z=SrcVertexBuffer[vertex].z;

 // Çäåñü ìû ïðîèçâîäèì ïåðåìíîæåíèå êîîðäèíàò âåðøèíû èñõîäíîé ñåòêè íà ìàòðèöó è çàïèñü ðåçóëüòàòà â èçìåíÿåìóþ ñåòêó
	DestVertexBuffer [vertex].x = EMatrix11*x + EMatrix21*y + EMatrix31*z + EMatrix41; 
	DestVertexBuffer [vertex].y = EMatrix12*x + EMatrix22*y + EMatrix32*z + EMatrix42;
	DestVertexBuffer [vertex].z = EMatrix13*x + EMatrix23*y + EMatrix33*z + EMatrix43;	
  }

}

Blitz Test
;andreyman.ucoz.ru
;(c)ANDREYman


Graphics3D 640,480,32,2

SetBuffer BackBuffer()


camera=CreateCamera()
PositionEntity camera,0,10,-30

light=CreateLight(1) 
RotateEntity light,50,80,0

Entity1=CreateCube();
PositionEntity Entity1,15,10,0
ScaleEntity Entity1,5,5,5
 
SurfaceSrc = GetSurface(Entity1, 1)
Vcount = CountVertices(SurfaceSrc)

Entity2=CopyMesh(Entity1)
EntityColor Entity2,255,0,0
PositionEntity Entity2,-20,0,0

SurfaceDest = GetSurface(Entity2, 1)

While Not KeyHit(1)

 TurnEntity Entity1, 0.5, 0.5, 0.5

RenderWorld()



If KeyDown(57)
Text 5,5, "Don't ransformate"
Else
Text 5,5, "Transformating SurfaceSrc(Red color)"
TransformSurfaceToMatrix SurfaceSrc, SurfaceDest,Entity1
EndIf
Flip 1
Wend
End

Decls
;andreyman.ucoz.ru
;(c)ANDREYman

.lib "VertexSample.dll"


TransformSurfaceToMatrix( surfaceSrc%, surfaceDest%, Entity%)



Yasha(Posted 2009) [#221]
And ..what about cell/cartoon shading :D ?


...all you need is a cubemap, surely? At least that's how I implement what I would consider to be cel shading.


BlitzSupport(Posted 2009) [#222]
New thread here!