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 / Adding objects with all effects on an advanced lighting project

Author
Message
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 9th Oct 2015 02:16
How can you add an object in the advanced lighting project and let it work with all the effects and shadows?

I have tried to load an object, texture a diffuse image on stage 0 and a normal map on stage 1, then did Object_Add(ObjectNumber), All I can see is a black object that cast no shadows, the depth of field seems to work on the object but there is no shadow and no textures.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 9th Oct 2015 04:26
Also for some reason adding 1 character to the advanced lighting map seems to slow down things A LOT, even lowering the details to the max (no posteffects, minimum water, minimun light, minimum shadows), it goes down to 32 fps while without the character it reaches around 100-110 fps. It's the same character I use in Lift It and I have loaded it just for testing, but in Lift It it doesn't slow things down like that, maybe 5-6 fps but not for sure 70-80.
With the character loaded the graphic options doesn't affect too much the framerate, it is Always low (from 25 to 35 using high or low quality), while without the character I have like 40 fps with maximum quality and 100-110 with all turned to the minimum.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 9th Oct 2015 21:51
assuming the character is animated, be sure that you use the bone animation version of the shaders and not the static object ones. there is a very big hit to performance otherwise.

try working with the AL bone animation demo project first and see if you can just replace colonel Z with your own guy and get it all working properly, then integrate it into your own project.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 9th Oct 2015 23:25
Ok, trying the example shader seems that the performance are better, and the textures are there, the only problem is that the mesh of my model are scre**d up because it has too many bones I think.
Is the shader example the one working with 32 bones only or it is the 60 bones version?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 10th Oct 2015 00:04 Edited at: 10th Oct 2015 00:12
Alright tested with a 53 bones model and it works fine, so it should use the 60 bones shader.

Thank you Ortu, I know you have a large experience with the Advanced Lighting, do you know any other tricks to get more fps other than these:

PostProcessing_SetUp()
Water_Create()
DirLight_Create()


Edit:

Also I am a bit confused with the texture stages, are the stage 1 and 4 the same texture? I see in the AL post that they are normal maps, but 1 is detail normal map, what is the difference?
And how can you create a specular map?
I have seen in the Bones example that the specular map is just a color and not actually a texture, the detail normal map is weird too, they are also very small size (32x32 and 128x128)
As every object or limb will have 4 textures, do you suggest to use a full size of all of them? or maybe just keep full size for the diffuse texture and normal map, and a reduced size for the specular and detail map?

Edit 2:

I also use to save both diffuse and normal map in .dds DXT1 format, am I wrong doing this or I should use a DXT5 format for the normal map?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 10th Oct 2015 00:46
I am having another problem also, seems that I can't set the object to transparent (so that rgb(0,0,0) are not drawn), for example for the eyelashes, hair, eyebrown textures of the character
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 11th Oct 2015 15:36
Can someone help me about this transparency thing?

In AL there is Add_Object() and Add_AlphaObject() but there is no way to make just some limbs transparent? I need the transparency for the hair, eyelashes and eyebrows.
Also what textures do I need to add in the other stages for the transparent limbs?
wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 11th Oct 2015 19:10
I don't use advanced lighting, but you could import those parts of the model as separate objects and glue them together after applying the right effects.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 11th Oct 2015 20:01
Yes but in this way they will not follow the object animation, I have tried in the past to attach a hair object to a bald character and the hair didn't follow the object animation.
Also there is a huge work of fixing the position of them, and maybe rotation. The AL project takes already alone like 40 sec to compile, If for every character I have to do all these fixes it will takes years.
Is it possible that Evolved didn't think about this problem? A character in a game is very common.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Oct 2015 23:40
Quote: "Yes but in this way they will not follow the object animation"

Yes they will. I use to do what wattywatts points you out, but instead of loading again, I make object from limb....then we hide those limbs and place new one in limb position xyz...then we rotate the new object to match the limb movements.
I\'m not a grumpy grandpa
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Oct 2015 00:34 Edited at: 12th Oct 2015 00:42
The parts of the model needs to have the Whole bones structure in order to be animated, If I load a 2nd character, so that in 1 I keep the normal parts, and in the other one the transparent ones, the game will lag so bad because the transparent shader doesn't handle the bones fast enough like the bones shader used for the normal object.
It's like when at the top of the post I was complaining about the performance, and then Ortu told me I must use the bones shader.

Also, when I ve tried to use that shader, other than the performance issue, the hair of the character had some transparency problem as well, like being almost White looking on 1 side and brown (as they should be) looking on another side, they also looked too shiny. No problems for the eyelashes and eyebrows, probably because they are too small to see any difference and they are very close to the object, so that between them and the sky you Always have the face, while for the hair you can look at them and don't have the face between the hair and the sky.

So does anyone knows a way to have transparent limbs on a bones animated model?


Edit: there is a diffuse.fx file in the animation folder, the same one where you can find the bone animated shader, if I try to use that one, the program crashes
wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 12th Oct 2015 01:16
If you glue the hair to the head limb it wouldn't need it's own set of bones, it would use the bone/limb it was glued to.
If you go with this method I'm fairly sure you can use the regular old set object transparency command on the hair and get rid of the appearance problems you described.
Also, I should point out that you're concerned about speed, but if I remember correctly you're using a model with ~60 bones and rendering transparent eyelashes and eyebrows. I'm assuming that's from makehuman; if so (again, if I'm remembering correctly) the clothes are modeled on top of the character instead of textured on, further reducing optimization. You owe it to yourself to learn how to make your own models, dude.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Oct 2015 02:19 Edited at: 12th Oct 2015 03:29
There is no issue at all about using makehuman for characters, loading the model, even if it has 21k quads, didn't lower almost at all the speed of the game when using the bones shader, so the only problem is the shader used and not the model used.
Also you are wrong, the clothes are applied as texture on the character model, there are no other polygons under the clothes.
And why waste hours to make a character from scratch that will look like sh** when I can do it way faster and better with makehuman?
It's like trying to make a new engine all by myself that will be worst both in graphics quality and rendering speed than dbpro, and will takes ages to do.

Another thing, If I want to lower the polygons on the character I have a way to do that with the 3d software I am using.

I don't know why you are pointing the fact to make my own characters from scratch, while here the problem is a shader.
Software to make objects are there to be used, like tree programs are made to make trees, characters softwares are made to make characters.
When developing a game one of the first things you should keep in mind is the time you need to do that, otherwise your game will never came out, and you wasted years for nothing.


Edit: Even trying to add just these 3 transparent object with the glue command, it seems to slow down the game a lot, even if they have no bones, seems that the transparent shader is damn slow. When I add the Whole character with the bones shader it doesn't slow down almost at all but if I add just a few polygons to be transparent they will a lot, how is possible?
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Oct 2015 13:41
Even the best game companies avoid to use so high poly models as the one made in Zbrush or Makehuman. These programs are more like oriented to render and video.

 
Quote: "When developing a game one of the first things you should keep in mind is the time you need to do that, otherwise your game will never came out, and you wasted years for nothing."

Looks like you've got everything clear.

I suppose that your minimung requirement display mode will be full HD or even better 4K.
I\'m not a grumpy grandpa
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Oct 2015 17:10
For the last time, polygons are not a problem, makehuman models are fine, and if I need to lower the polygons I can as much as I want.
The problem here it's a SHADER.

Also, based on what you say that the requirements of my next game will be HD or 4k?

The AL seems to work only on 800x600 and 1024x768, on other resolutions it gives a black screen.

Also I have already managed different graphics options, with the maximum quality I get 40 fps, with the minimum I get around 90-100 fps (and yes, there is a 40k tris makehuman model loaded), and I am programming on a notebook with a nvidia gt 635m, which is not a great graphics card actually.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Oct 2015 17:34
AL works with much more resolution than 800*600. Here in my laptop it runs at 1366*768. It is a wide screen 16" , and I got 59 FPS. I suppose that it depends on the PC we have. About the high poly, we can load some objects and probably it goes ok , but every time I see my grandson playing minecraft I say to myself we had to reach the sky, and now we play marbles.
I\'m not a grumpy grandpa
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Oct 2015 17:49
Yes I have a 15,6" screen too but I can get it to work only with 640x480, 800x600, 1024x768, if I try 1280x720, 1280x768 or 1366x768 I get a black screen.
I still don't know why that happens, maybe someone expert with AL could put a light on this
If I keep the standard graphics options of AL I get aprox the same fps as you, I am using at the moment 3 graphics variables to decide the quality of posteffects, water, light and shadows. Maybe there are other things I could tweak but at the moment I know only these 3.

By the way the next project I will do will be a simple one, with few stuff to load, that's why I am using AL and full poly models.

I just can't understand why the Alpha diffuse shader is so slow, even with simple objects that has no bones, while the bones shader doesn't almost slow down things at all.

For example, if I apply the bones shader to my 42k tris character, I lose maybe 2 fps probably, with maximum quality, while if I apply the Alpha shader just to the transparent objects, that have no bones and just 2-3k tris, it slow things down by like 10-12 fps.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Oct 2015 18:15
Like most people, I use only darkshader (most of them from Green G), and I haven't any problem. How many human models can you put on scene with AL shaders?....I ask you that, because we could do some tricks .
I\'m not a grumpy grandpa
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th Oct 2015 18:32
I have no idea, they seems to slow down the game as much as with normal shader and without AL, the only big slowdown I have seen is using the Alpha shader as I was saying before.
Keep in mind also that objects could be hidden or excluded, so a character could be rendered for example only if you are in a certain room
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Oct 2015 20:29 Edited at: 12th Oct 2015 20:32
sorry for taking a while to get back to this, let me try to answer some of this. I'm not an expert on AL, but here are some things I've found in using it.

for transparency on animated objects:

there is not a shader for alpha blending (partial transparency / ghost) using a greyscale alpha map, but there i are some for 2bit transparent clipping (fully opaque or fully transpatent using a black and white alpha map.

the alpha map uses the alpha channel on the diffuse texture.

this works well for eyelashes, leaves, and anything that uses a hard edge between transparent and not transparent. it doesn't work so well for hair (well it works fine but hair really needs greyscale alpha blending to look good)

you don't need to make the transparent parts separate objects /limbs for the clipping shaders.

the shader i use for my character is located in AdvLighting/shaders/surface/animation/normalmap clip.fx

it uses object_add not alphaobject_add

the alpha object_add command is fir anything using the shaders located

AdvLighting/shaders/alpha/

and these do use greyscale alpha blending, unfortunately there is no bones animation version for these.

in general you can use the dbpro command set limb effect to set different shaders to different limbs you should only need to register the root object to AdvLighting once with object_add regardless of how many different limbs/shaders being used.

i have not tried to mix both surface (object add) and alpha (alpha object add) on the same object via limbs, but i would guess you probably can and would use alpha object add.

these add commands register the object with the AL update and rendering systems, the only difference it'd that alpha object add does some additional work to handle layering of transparencies, it shouldn't hurt to use this on a non alpha object, but an alpha object won't render properly using just object_add
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Oct 2015 21:07
the texture stages differ between shaders and versions of AL.

when in doubt, open hippo the shader in text editor and have a look at the texture block near the top. they get loaded in order first texture listed is stage 0,next is stage 1 etc.

for most of the surface shaders, it goes like this:

0: diffuse - rgb = diffuse color, a = 2bit transparency

1: normal map - rgb = standard tangent space normals

2: specular map - this one changed a bit a while back, off the top of my head, i believe it currently uses red channel for power (how bright/intense the specular highlight is), green channel i think is glossiness (controls tight hard spot, or wide spread) blue i think does reflectivity. if the green channel is set to 0 i think it disables lighting on the object and it just renders flat diffuse.

AL always tends to exaggerate the specular and values that look good in say Blender get blown out in AL, so set these low and brighten as needed. the key to good specular is subtlety.

stage 3: detail map, i don't use this one much personally, but it is a tileable texture that will be repeated across the object. it should not be laid out to the objects uv, it should be a smallish tileable square.

stage 4: subsurface ambient occlusion - you know when you stick a finger up to a light, it gets sort of see through and red? this does that. rgb controls the color while alpha controls intensity i believe.

i can post some texture samples that i am using later, there are also some in the AdvLighting/textures folder, just be sure you are using a graphics program that can view channels individually.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 13th Oct 2015 20:26
Ok thank you Ortu, I have tried to use the Normalmap Clip shader and it does the transparency, as you said it doesn't use a greyscale map so the result is not the same as having a second object and setting it with the proper Alpha.
The good thing is that the performance are the same as usingthe Normalmap clip, so using a 2bit transparency doesn't hurt the performance.
I wish there was a greyscale version of the shader.

By the way, for the transparency limbs (hair, eyelashes and eyebrows) I am using just a diffuse texture with transparency, do I have to apply also the other stages as I did for the non-transparent limbs of the characters (normal, specular and detail maps on stage 1,2,3)?
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 14th Oct 2015 00:00
if you are not using the normal and specular, there should be just a plain diffuse clip version that only needs the rgba diffuse texture on stage 0. it likely will have better performance than the normalmap clip as it isn't doing nearly as much processing.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th Oct 2015 06:37
What about the format of the textures?

Is that fine to use .dds DXT1 for the diffuse and DXT5 for the normal and specular map?

Or it's a waste of memory? Can I use the DXT1 for all of them to save video memory or it's a bad idea?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th Oct 2015 07:33
By the way it's such a shame that there isn't a bone version of the greyscale transparency shader, it looks a lot smoother, the eyebrows are completely different. but using the non bone version it really slow down too much the performance.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th Oct 2015 22:12
Is it not possible in AL to scale object limb texture? It doesn't work I see
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Oct 2015 19:33
Everyone disappeared? Is it possible that is impossible to scale a limb texture in the Advanced Lighting? Why it doesn't work?
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 18th Oct 2015 21:52
Quote: "Is it possible that is impossible to scale a limb texture in the Advanced Lighting?"


Just made a test and yes...we can scale a limb texture.
I\'m not a grumpy grandpa
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Oct 2015 22:06
This doesn't work for me



this neither

Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Oct 2015 22:11
Neither using this to texture:

Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 20th Oct 2015 07:20
This problem resonates with a similar one I had with scroll limb texture on an object with Bumpmapping shader applied (thanks again GG).
Couldn't use DBP scroll limb texture direct command but had to feed the shader variable at run time.

DBP code:


shader scroll part:


Maybe you are in a similar situation with scale limb texture with a shader.
But Chafari stated it's possible , maybe he can provide an example.

Cheers
Kuper
16
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 22nd Oct 2015 09:38 Edited at: 22nd Oct 2015 09:39
you just need to scroll texture before apply shader
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 22nd Oct 2015 16:30
I need to scale not scroll, btw if you look at my post I have tried both doing before and after applying the shader, and none works.
I prefer to not change anything in the shaders because I am using the AL system and I don't want to break anything, so I ve ended up using a separate object and scale it as object, not limb.
Also I don't know why but I see some artifacts in the shadows, something like stripes showing on certain angles
Kuper
16
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 23rd Oct 2015 01:29
@Cescano
You also can scale texture and then save object throw DBPro.Maybe this will work.
Also this is from Point light demo.Scale texture works correctly.

ps
Can you post image with shadow artifacts?Do yoг change something before you get it?
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 23rd Oct 2015 01:35
I was complaining about scaling a limb not the object, obviously the
object works that's why I have splitted the limbs in more objects to
be able to scale the texture (as a workaround)
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 23rd Oct 2015 01:58
And here the weird shadow artifacts

Attachments

Login to view attachments
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 26th Oct 2015 19:17
I have also another problem, seems that with some objects, the closer I get, the more the object is blurred, shouldn't it be the opposite? to test this you should use PostProcessing_SetUp(1,1,1,1,1,1,1)
wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 26th Oct 2015 19:32
Quote: "I have also another problem, seems that with some objects, the closer I get, the more the object is blurred"

In the blur shader, there are near and far values for the DOF effect you can tweak.
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 26th Oct 2015 22:09
Can you point me where to look exactly? I can't find it.
wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 27th Oct 2015 00:16
It should be in shaders/post processing/blur.fx,
specifically these lines:
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 27th Oct 2015 00:50
Thank you! I have changed the near value from 10 to 2 and seems to be better.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 27th Oct 2015 20:55 Edited at: 27th Oct 2015 20:56
You can also set these values in dbpro code, I use it to dynamically change the depth of focus based on the camera's focal point/distance, you can also use it to set up user preference sliders and the like

Login to post a reply

Server time is: 2024-04-19 01:02:05
Your offset time is: 2024-04-19 01:02:05