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 / Multiple UV/Texture layers/stages from blender to dbp?

Author
Message
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Aug 2014 06:52 Edited at: 11th Aug 2014 06:58
Hi has anybody worked out how to do this? I`m referring to the limit of 8 texture layers in dx9 which blender appears to identify with in the editing tab of the buttons menu.
I`m using 2.43, I have 2.71 but I barely got to grips with 2.43 when I last played with it and that was quite some time ago. I tried to get into 2.71 but didnt have any luck - everything is so different and some things in different places, truthfully unless the older version cannot do this and the new one can then this is the only way Im gonna delve into it - I have had everything else Ive wanted from it and this is only thing bugging me now. I`m not talking about materials or sub meshes, all the links/vids Ive come across always lead to selecting different faces to apply materials or textures - which inevitably results in sub meshes. The search results were mostly outdated to say the least.

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Aug 2014 12:20 Edited at: 11th Aug 2014 12:22
Hi there
Blender 2.71 is very different, and at first is like a nightmare. Time ago I tried to do something like that. I wanted to save lightmaps to apply into Dbpro.I realized that I could make a full render to mix all textures . The bumping is not appreciated though . Finally, we use a single image with all the mixed textures as we normally do in DBPro.



Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 11th Aug 2014 13:43
Unless you have dbo exporter for blender i don't think you can do that.
if you export to x you'll get only one stage and that is the limit of x format.

James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Aug 2014 15:08
Quote: "The bumping is not appreciated though"

What? this is a new thread, different topic, this aside I come to this forum almost everyday to read and rarely is there a time when there are enough posts on this board to annoy folk with bumping. You certainly are a grump grandpa! This has nothing to do with fixing dbp and to be fair for some reason I cannot explain I missed several posts at the end of that thread before posting even though they were days old! Also I only double post once by mistake - at the end and the previous post was a day inbetween posing questions I later answer. I wasnt rude or anything, worst I said was "um". If I edit a post then noone gets any notification of the change, an issue raised in the beta forum..I clearly thought I was helping out there, sure I posed questions, but then I did provide an example of solution even though no solution was needed lol! And yes I have done something similar in past(just ask GG), mainly because I rarely post here due to ppl rather wishing to nitpick argumentative points in order to establish some form of authority against the OP. This aside I do appreciate your effort here. I havent bothered with baking as of yet as Ive had no need for it so far. Also here I clearly stated what I want help with - I do not wish to make a single texture from many uvs as 1 atlas. I only wish to alter 2 texture stages of uv data with a succesful export of the data in the x file - from blender. Though I do understand were your coming from - you wish to guide in the direction of easier methods to acheive same goal - a workaround, however this won`t do - I require the uv control in blender this way as I wish to test submesh loading times with additional textures, Id rather use submeshes with the ability to have many different trees as 1 mesh rather than load each trunk/leaf component per tree as thats significantly way too many draw calls. A quick description of my goal if you will;
trees look better imo if the barks texture is a single image wrapped to scale(tiled) whereas the leaves look better if clamped and using different leaf branches from an atlas. Also uv mapping a trunk wothout texture wrap means large parts of a texture atlas and it still doesnt look as good as wrapped texture. I want to create several trees as a group in 1 mesh(to mimick batching) in blender but texture each individually. This can easily be done with submeshes 1 for each trunk type 1 for each leaf type. But to normal map using dbp shader would mean 1 normal texture without being able to match same textures and uvs. This will not solve the issue as still there is problem of clamping/tiling the same texture, but if in blender I can find out how to have 2 uv layers then I can determine if xfiles/direct x supports submeshes per uv layer/texture stage. All of this is a test to see if its suitable for my aim to use lod levels 1/4 size of previous LOD level across several layers of objects layed out in grid pattern so that each layer of LOD is 4* larger than previous. the layers of lod zones are shown hidden accordingly. Simple batch test of diffuse only objects(the meshes can be indivdually different yet there is big limit on texture flexibilty ) with dlod/hlod gave me superb results when used in this manner in evolveds old ALS when I used KD lod plugin to mask them to right cameras instead of masking them the way evolved has it set up - masking using evolveds old code dropped fps massively where as kahaedros plugin gave same visual results with very little fps drop. Pics of results are posted early on in page 1 of the dbp elite thread, and that fps in those pics is on a 9600gt card, due to many cameras the draw calls are high so with 200 draw calls its like have nearer to a thousand(from tests years ago approx 1k drawcalls was the ceiling for this card in dbp before it drop below 30 fps). I realise at this point that even if this is possible in blender then it wont help me in dbp directly. It would be my intention to have a process in the level editor for level data that writes the x-files manually. Not exactly easy as there are so many variations of xfile format but if I can study and learn just 1 that does exactly what I require then I beleive I am on the right track.

Brendyboy
I havent checked recent updates to dbp but I did check this a few years back in memblock meshes using single plain mesh and dbps internal commands for blend mapping light map, the uvs worked out a treat. The x file does support multiple UV`s, make a mesh of suitable fvf in dbp, alter two lots of uvs and save mesh. Load into dbp, retexture and so you have an xfile with multiple uv`s, the real question is does blender support this or does it decide to drop it after 2.43 in favour of submeshes only? I find this hard to beleive - as you see in my image 2.43 certainly had some support, else why bother to have the option of no more than 8 textures/vertex color slots - fits exactly top same limitation to the fvf structures as far as I have tested. I beleive blender had data blocks for uvs for functionalitiy - so that you can copy from mesh to mesh or reuse data etc ?I think you get the pic..thanks for your input, appreciate it.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Aug 2014 15:22
Quote: " You certainly are a grump grandpa!"


Sorry if I misunderstood your question.I am old enough to discuss with children.

I'm not a grumpy grandpa
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Aug 2014 15:49
Quote: "The bumping is not appreciated though"


I just found on google the meaning of bumping, "bump "(reliev of objects).

What I just tried to say, is that when we use the trick of mixing textures, in Dbpro, we where not going to see the "bump" ....NOT BUMPING at least with the meaning you have understood. Sorry again for the misunderstanding .

Cheers.

I'm not a grumpy grandpa
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Aug 2014 17:02
Ah I see, then please accept my apology, I thought it odd you wrote that! If i had been through that process then I would have understood you first time I think.

I have played with the materials but failed to get a material Ive assigned to show up on the object. I tried normal mapping with a plain red texture with black letter detail and a random normal map, the materials window showed result as fine but cannot for life of me work out how to get it to show up on the object in 3d view, best I could manage was an all red object(appears without texture detail - almost like it took first pixel of image as vertex color, yet this option I have deactivated), when rendered all I could see was a black object with some red highlights on the areas the normal map has "bumps". There is a light in the scene else I would not have seen the red surface of the object - it would remain black otherwise. I followed this by ortu I think;
http://forum.thegamecreators.com/xt/xt_apollo_pic.php?i=2263954
In any case the export did not show anything that was any different to one exported with just 1 texture and I did not use the uv editor in any way - in fact the images werent even listed in the options for uv editor - it was all through the material and the xfile did infact have details of the first texture. In the case of submeshes the textures are all listed but only one is correctly named with the images file extension suffix, so I was kind of expecting to at least see a material structure and partial file name for the material in the xfile.
What I really need is to see the output xfile from blender(along with tutorial), from an object that has 1 face with 2 textures assigned to it to see if that produces submesh instead of a change in fvf, so far I can only use the uv editor to assign image to face but it wont let me assign another image to same face. Ive even put up with the many videos of tutorials and everytime someone mention multiple uvs seems to be related to materials, but then they go and soddin apply the same method as texures - in the uv editor; 1 texture per face max. I realise I wont see the output correctly in blender without using shaders, but I wish to see the steps prior to this so that the fvf is altered in the output, by the looks of the export from the partially failed export with normal map, simply using blender shader with a mesh and 2 textures does not make any change to the output xfile in terms of the extra texture stage.
If I had the ability and knowledge to write a plugin for submeshes then I would but that isn`t going to happen!
Ive looked at the modifier for uv project but can`t make head nor tail of it, searches for help yeild results that are once again related to submeshes or regular unwrapping with seams etc for just 1 texture
Quote: "I'm not a grumpy grandpa "

this is true did you just change your sig or did I previously misread it?
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Aug 2014 17:23
Quote: "Ah I see, then please accept my apology"

Don't worry. Some 3D programs refer to this like bump mapping, others like Blender use Normal maps etc. I can speak english, but some times I confuse some tecnical words.


Quote: " so far I can only use the uv editor to assign image to face but it wont let me assign another image to same face"


What I meant above, is that we can bake a full render to use the generated image in Dbpro. We can mix images in Blender and bake it as a single texture .In Dbpro, we won't see the "bumpmapping", we have to use a shader with normal maps.

Cheers.

I'm not a grumpy grandpa
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Aug 2014 18:12
Quote: "I can speak english, but some times I confuse some tecnical words"

English is my only language and I still fail miserably!
Quote: "What I meant above, is that we can bake a full render to use the generated image in Dbpro. We can mix images in Blender and bake it as a single texture .In Dbpro, we won't see the "bumpmapping", we have to use a shader with normal maps.
"

Yes this is what I thought you meant after your last post.
Do you know(or anyone really) if you can assign more than one texture or uv project to the same face in blender - or even vertex color for diffuse for each texture stage as suggested in image in 1st post?(without duplicating the mesh)
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 11th Aug 2014 18:16
James
what you want to achieve isn't supported by x format, not 100% sure though but i am sure that that kind of x format dbpro definitely can't load.

i know what fvf format is and i'm quite sure that x format only supports fvf formats with one set of uv coords.
x format was created mainly for demonstration of directx, it wasn't intended for use in a full game.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Aug 2014 20:00
Quote: "i'm quite sure that x format only supports fvf formats with one set of uv coords."


I'm fairly sure that DBPro supports it's own version of X files which DO have more than one set of UV coordinates.



Powered by Free Banners
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Aug 2014 20:59
Quote: "i know what fvf format is and i'm quite sure that x format only supports fvf formats with one set of uv coords."

There are FVF flags for up to eight texture coordinate stages...
That said I don't know whether these will work with a .X file; as Green Gandalf suggests the .DBO format likely does store that however.


"Why do programmers get Halloween and Christmas mixed up?"
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Aug 2014 22:26
Hmm, in a bid to produce the x file to show the two uv layers I had to start from scratch as I have lost almost all my projects a while back when I lost all 3 hdd`s in 1 incident of open tower + hot drink :/
so I made a start and things appear to be different since I last did this - the mesh although created is either wrong or dbp v1.077(u7.7) did something to break this, as you can see dbp reports no tris and nothing is visible:



can anyone shed any light on this?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Aug 2014 00:18 Edited at: 12th Aug 2014 00:32
This demo works for me:



The above demo creates a high poly plain using the Matrix1 version of the make object plain command and gives it 2 sets of UV data. That mesh is then saved as an X file and reloaded into DBPro as a new object. As you can see, the FVF format is preserved. In fact you can see it in the x file itself (attached) - the extra data is contained in the structure called FVFData. (Actually the DirectX description of that structure doesn't seem to match it's usage in DBPro - but that's another issue. Perhaps that's the special DBPro implementation I was thinking about.)

However, unless there's a bug in the Matrix1 command, that doesn't work with more than 2 sets of UV data so my earlier comment was misleading. With more than 2 sets DBPro only seems to save 2 in the x file. As Rudolpho suggested you can save the file as .dbo instead.

Edit The problem seems to be the way DBPro loads the X file - the saved X file with 3 sets of UV data seems to be correct as far as I can tell. Worth a bit more investigation I think.



Powered by Free Banners

Attachments

Login to view attachments
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 12th Aug 2014 00:37 Edited at: 12th Aug 2014 00:39
i'm 100% sure that X supports 8 UV coordinates ! Don't know how Blender exports the X file but 3ds max (panda exporter) can export up to 8 UV coordinates

Regards

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Aug 2014 00:52
Quote: "i'm 100% sure that X supports 8 UV coordinates ! "


It does - but doesn't seem to load them correctly from an X file.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 12th Aug 2014 01:17 Edited at: 12th Aug 2014 01:21
Thanks for that, very interesting indeed. I am going to call it a night as I have had enough for 1 day, when I close my eyes all I get are images from all those videos!! Why o why most of them insist on long pauses while they wave their mouse around as they um and ah is beyond me lol feels like I lost half day to this alone. Tomorrow i will revert back to older version(s) of updates and see if a 3rd layer produces same loading results using memblock mesh as I only ever tested 2 layers - I left it as it was, ASSUMING the other layers were as good as done if the first 2 worked! Thanks to all for their input, much appreciated
Dang I missed those last 2 posts while making this one - any chance of uploading a simple cube xfile with 8 uvs? I want to see if blender has a brain fart importing it. Wish I could afford 3dsmax :/
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 12th Aug 2014 02:13 Edited at: 12th Aug 2014 02:15
Here it is .This example uses 2 uv coordinates with multi sub object material (2 diffuse textures and 1 lightmap) (one UV for diffuse textures and one for lightmap)

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]

Attachments

Login to view attachments
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 12th Aug 2014 03:01 Edited at: 12th Aug 2014 03:02
Nice one, this perfectly demonstrates that 2 uvs and sub meshes together are supported in x files, not only that but it loads in dbp! Thank you very much for bringing this hope to me at the end of a miserable day. Now I`m gonna be like a dog without a bone forever searching...either that or you will see me on the news for robbing the bank to pay for max
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 12th Aug 2014 03:43
Quote: "It does - but doesn't seem to load them correctly from an X file."


Yes , but this is a limitation in DBPro (and not just DBpro , irrlicht , ogre also supports only 2 texture coordinates). The FVF data is available in the x file , all we need is a custom vertex format and a custom .x loader to load this data.But it's pointles , because no one use more than 2 sets

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 12th Aug 2014 04:01
@Hotline
can 3ds max have submeshes for the second texture stage aswell as the first? ie imagine you were matching normal maps for the second uv layer with the diffuse textures of the first uv layer.
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 12th Aug 2014 05:07 Edited at: 12th Aug 2014 05:15
Hm i've never tried this , in DX9 it is possible , but in DBPro i'm not so sure. If you load an X file with multi sub object material you can only use it as it is... , you can't access the textures , you can't access the subsets , you can't change anything... So in DBPro i don't think that's possible.

AFAIK Multi sub object materials and shaders (e.g normal mapping) can't be mixed in DBPro

@Green Gandalf :
Quote: "The problem seems to be the way DBPro loads the X file - the saved X file with 3 sets of UV data seems to be correct as far as I can tell. Worth a bit more investigation I think."


Oh i didn't notice you posted an example... yep same for me too... the 4th UV set just messes everything up.. including the first 3 UV sets (random roations , scale , etc)

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 12th Aug 2014 14:00
Hotline - at this stage I don`t wish to access the sub mesh textures in dbp or a shader. I wish to determine if dbp can load an x file that has 2 uv layers with sub meshes for each uv layer. In your example the only texture added to the model in dbp code is for the 2nd uv layer. Blender like 3ds max, (in terms of 1 uv layer with sub meshes)will detail the textures for submeshes in the x file and dbp will auto load the sub mesh textures, so if in 3ds max submeshes relating to the 2nd uv layer can be applied and exported successfully and dbp can load the file, then we won`t see the desired result until we apply a shader. We dont need to do anything with the textures in the shader or in dbp code as they would be auto loaded. Simple example, I have a simple shader that only uses the first texture stage and just scrolls the texture using the uv`s, I have a cube made in blender with 4 submesh textures with just 1 uv layer that succesfully load in dbp, when the shader is applied I see the desired result(all submesh textures scroll) but I haven`t had to alter anything at all in terms of the model or textures.
As you have been the only person to come forward with a working example with 2 uv layers and several sub meshes that relate to the first uv layer, I was hoping you might use the same model you provided and apply more submesh textures to the second uv layer in max then upload the file along with the addition textures. Then I could load into dbp and apply a shader to see if the desired appearance is achieved. The textures could be anything, I have a blend shader that will result in a mix of both uv channels textures, similarly if the second uv layer/channel textures where all normal maps then the normal map shader could be applied just as easily. Provided you were willing and did produce a succesful x file export then the only way we can tell in dbp if it was 100% succesfully loaded would be with a shader applied. I hope I explain this well, but my terminology is poor and I am as good at explaining what I mean as a 1 day old child is at rocket science!
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Aug 2014 14:12
Quote: "The FVF data is available in the x file , all we need is a custom vertex format and a custom .x loader to load this data"


All we need is a bug fix. If DBPro can save the mesh correctly with more than 2 sets why can't it load the same file back correctly? Smells like a simple bug to me - and probably a simple oversight by Lee. It's happened before you know.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 13th Aug 2014 03:05
Well there was no need for me to revert to older update - stupidly I accidentally made numvert plural in 1 line...I can now confirm that memblock mesh saved as a mesh preserves third uv layer correctly - appearance with blend shader altered for 3 textures is correct in darkshader but as expected the load object command in dbp is bugged as the 3rd textures uv`s dont work but previous 2 textures uvs appear just fine.
Green Gandalf - are you going to write a bug report? After all you spotted it - any clue if Lee will fix this? (As its highly likely to be confirmed you could always drop a hint to get submesh control into dbp!)
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Aug 2014 12:54
Quote: "Green Gandalf - are you going to write a bug report? "


Good idea - but whether anything will come of it is another matter.

Quote: "As its highly likely to be confirmed"


Is anyone checking those Bug Reports at the moment?

I'll see what I can do.



Powered by Free Banners
Hotline
15
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 13th Aug 2014 22:57
Quote: "at this stage I don`t wish to access the sub mesh textures in dbp or a shader. I wish to determine if dbp can load an x file that has 2 uv layers with sub meshes for each uv layer. "


Well no , thats not possible. I don't know it's a limitation in the .X file format or the panda exporter can't do it , but you can have exacly 1 texture per face (diffuse). No matter how much texture layers you have in your 3ds max material , Panda exports the diffuse texture only.

Regards

[href=forum.thegamecreators.com/?m=forum_view&t=191567&b=5]Spark Particle engine[/href]
[href=forum.thegamecreators.com/?m=forum_view&t=199163&b=5]Transform gizmo plugin[/href]
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 13th Aug 2014 23:49
Green Gandalf - good point and thanks

Hotline - thats a shame, thanks for trying

For the time being I`m going to have a play around with the relevant x files, mess about some more with blender, delve back into vertex commands and see if I can at least find a way of creatng models with control over 2nd uv layer. Should be doable. I can always use a larger atlas for the second texture stage and switch between zones and still produce something reasonable for testing with. Thanks to all
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Aug 2014 00:19 Edited at: 16th Aug 2014 00:19
Ok I messed up a bit, when I said 3 uv layers saves fine as I saw expected result in darkshader - I was wrong - as it was a shader I had altered some time back I hadn`t realised that I had scaled the 3 uv layers seperately in the shader, when I looked at the shader code initially I thought it was ok as I thought they were the blend offset values, so afterwards when I looked at the 3 uv layers what I saw appeared correct because of this. On reaizing I went back to 2 uv layers, I reinstalled darkshader(I seem to have lost original blendshader) and used the blendshader from that and it appears that the uv data is always stolen from channel 0. I checked with other shaders from dark shader and its the same with them. I have no other shaders to test with. Here are results for memblock mesh;

2 channels(blend mapping command):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : pass
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

3 channels(blendmapping command):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : fail
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

2 channels(detail/blend shaders):
MakeObjectFromMesh : inconclusive
***these shaders use channel 0 uvs
***test.x provided by Hotline - lightmap uvs lost to channel 0

In terms of blend mapping - the only fail was loading a mesh as an object, with 2 uv layers this works but not with 3 uv layers, suggests perhaps loading mesh as an object was not intended use but then why would 2 uv layers work this way just fine?
I will next test vertex data commands to see if the second uv can be controlled with the blend shader applied as currently the shaders(at least the ones used) steal uvs from channel 0
I have no real clue when it comes to shaders other than using those already in existence and making the odd minor change. Is anybody aware if shaders are always to steal data from channel 0 for other uv layers?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Aug 2014 02:24
Quote: "Is anybody aware if shaders are always to steal data from channel 0 for other uv layers?"


Shaders should be able to use UV data from any stage that exists in the object - in fact standard lightmapping relies on that (for two sets of UV data).



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Aug 2014 04:09
ok thanks, I have evolveds lightmap fx from mapscape working
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Aug 2014 13:59
2 channels(blend mapping command):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : pass
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

3 channels(blendmapping command):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : fail
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

2 channels(shader):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : pass
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

3 channels(shader):
MakeObjectFromMesh : pass
SaveMesh/LoadObject : fail
SaveMesh/LoadMesh /MakeObjectFromMesh : pass
SaveObject/LoadObject : pass

Well I see my mistake in the blend shader, still cant beleive I thought the blend values in the pixel shader would have been uv values! Especially as it was me that put the uv changes in the vertex shader, its been so long since I got back into dbp is all I can attribute it to, that and not paying attention and not making notes of what Ive done in the past. Real sorry for confusion I may have created. As can be seen same results for shaders and blendmapping, 3rd uv preserved except when loading a mesh as an object, so when I said "highly likely to be confirmed" I was er ever so slightly misguided XD
Will consider 4th uv test when Ive looked at vertexdata
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Aug 2014 17:08
Quote: "so when I said "highly likely to be confirmed" I was er ever so slightly misguided "


When you said that I assumed you were referring to this case:

Quote: "SaveMesh/LoadObject : fail"


which is where I said the problem was.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Aug 2014 22:18
hmm that last part you quote is the end of the paragraph but theres a huge part missing just before it and after this part "...As can be seen same results for shaders and blendmapping, 3rd uv preserved except when loading a mesh as an object,"
I didnt keep a copy but as you have guessed I have a slight change of heart - although I have changed my mind on this Im not saying it isnt a load object bug either, Ive gone back to not being able to make my mind up - so let me try to fill in the gap as best I can;

Intially this looks like load object for sure but as I suggested earlier(Post: 16th Aug 2014 05:19) it could be that were not supposed to use it this way.
Ive been thinking and I could swear that once upon a time I used save object for .x files as I know there was a time I came back to dbp after a long stint not using it and found the .dbo format existed and was now the only format the command would permit, since then always used save mesh for what Ive needed. I know I used to use memblock files for my geometry in the project I was getting back into so it may be that save mesh was absent aswell. This is speculation without certain knowledge but I know some is true, my memory is bad but doesn`t usually make stuff up. But why not allow save object as .x we always had save memblock as far as I can tell so why have save mesh? I`m kind of thinking MAYBE x files have at least 2 flavours, mesh or object - both share the same format so why not? the mesh file is useful to other apps with out additional material, animation etc which is how they seem to be when saved this way.
Also based on dbp helpfiles use of the word mesh and not object, it describes them in more of a building block framework for levels or complex objects
The tests only show there is a problem while loading a saved mesh as an object. To me I need proof the file being loaded is truly an object to be able to say that load object is the fualt. This is odd I know, but when using a mesh as the source we are really asking dbp to load a mesh as an object. So are we saying we saved the mesh as an object or we saved the mesh as a mesh? I think you can tell Im confused! I do realise that having it load as an object could be useful but is not save mesh/save object a possible reason behind the output mesh file not being suitable for loading as an object?

When I said "highly likely" I was super certain - Im now saying Im not even certain, also Im saying I was not misguided by anyone, other than myself of course.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Aug 2014 22:40
Save mesh saves the mesh as an X file which can then be loaded back as an object.

I've just this minute noticed that there is a parallel load mesh command. I've never used that command so it would be interesting to see if that loads the 3+ UV meshes correctly. It certainly seems to be the case that save mesh does indeed save the extra UV data so perhaps the load mesh command works as well. Can't test this at the moment as I'm supposed to be cooking supper. But I have got just enough time to make a quick post.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 16th Aug 2014 22:51 Edited at: 16th Aug 2014 22:57
Yes it does - its because it does that I changed my mind, thats what this test is: SaveMesh/LoadMesh /MakeObjectFromMesh : pass
So far it saves 4 layers and loads 4 layers successfully. This is why I think load object is not for saved meshes.
*have no clue about matrix1 mesh though, or meshes grabbed from an object, also I checked load object mode flag and they seem to have no bearing here, I wonder what option 5 works in conjunction with? FPSC?*
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Aug 2014 23:52
That's excellent news.

It hadn't dawned on me that you were actually using the load mesh command (which at that point I hadn't heard of ).

So, yes, it seems that the problem is exclusively with load object when used with X files containing more than 2 sets of UV data.

Thanks for clarifying that - and sorry for any additional confusion I've caused.

I've learnt something useful today.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 17th Aug 2014 00:38
Interestingly a mesh with 4 uvs saved as an x file crashes darkshader when loaded, but x file meshes with 3 uvs downwards has no issues, yet if the mesh with 4uvs is changed into an object and saved as .dbo, darkshader has no problem with it. In addition to this I have now tested vertex data commands on uv layers. The results for a blend mapped object and a blend shaded object where the same.
For objects created from meshes with 3 uvs or less everything was fine.
For object created same way with a fourth uv, the fourth uv layer can be altered just fine , however, the 1st 2nd and 3rd uv layers when accessed to write, make the surface of the geometry disappear, dbp still reports poly`s, limb and object as present. Go figure. These were again single poly mesh object from a memblock with just a root limb. No saving or loading of files involved. Relevant files attached

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Aug 2014 02:17
Quote: "however, the 1st 2nd and 3rd uv layers when accessed to write, make the surface of the geometry disappear, "


I vaguely recall someone posting a bug report along those lines a while back.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 17th Aug 2014 02:48
Thanks for that I found the report, changing to lock mode 0 seems to have fixed it. Will bare all you said in the report in mind for future. Bookmarked it for now
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 18th Aug 2014 03:02 Edited at: 18th Aug 2014 04:36
Ive put 5 uv layers tests upward on hold for the moment as I want to get back to the x file format
Ive identified the area of code that details submesh materials - the meshmateriallist section - where the first value is the number of materials the second being the number of faces, the list following this is the material reference per face, and of course the materials defined straight after. The first material being referenced as 0, the second material as 1 and so on. This is taken from an x file exported by blender with submeshes that work in dbp;

MeshMaterialList {
3;
6;
0,
1,
0,
2,
0,
0;;
Material Mat1 {
0.800000; 0.800000; 0.800000;1.0;;
0.500000;
1.000000; 1.000000; 1.000000;;
0.0; 0.0; 0.0;;
} //End of Material
Material Mat2 {
1.0; 1.0; 1.0; 1.0;;
1.0;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename { "uv1.bmp"; }
} // End of Material
Material Mat3 {
1.0; 1.0; 1.0; 1.0;;
1.0;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename { "uv2.bmp"; }
} // End of Material
} //End of MeshMaterialList

As you can see there are 3 materials (mat1,2 and 3) defined immediately after the list, but before the list is declared as ended
In this file the mesh data is a cube with each face as 2 tris and not 1 tri so the face list will not be 12 but 6, as faces are indexed this way in this particular format
In material list, 3 is number of materials used, 6 is the number of faces used, the first 0 is in slot 1 and corresponds to the first face from the index, in slot 2 is the value 1 which corresponds to the second face of the index, 0 is mat1 and 1 is mat2 etc this list goes line by line to match indexed faces but can also be written as 1 line as long as commas seperate the values and semi colon signifies the end
Im very aware that each submesh can only have 1 material assigned, but a texture is a material compnent so in theory any texture from any stage could be used and I can think of several ways of detailing the data that suits the current format, for example for multiple uvs the data is layed out u then v listing vertex 1 layer 1 then layer 2 before moving on to vertex 2 layer 1 etc so in case of submesh I would expect it to be similar so the layout might be;
number of materials
number of faces
1,4,
2,5,
the second value in face list being the extra dimension of the array for uvlayer2 submeshes; array(ndword,1)
as you can see I have no clue on the array - I only have dbp to go off
Anyway Ive messed around a bit and it seems direct x wont utilise any info after the limits of the material list array ends. So it looks like if there is a chance of submeshes with textures specific to a second texture stage index, the array being used cannot account for this, so Im thinking declare a new template with an additional dimension or a second array to be declared. Now you might think, well get on with it then, but problem is any attempt I make to define existing template not detailed in the x file stops the file being loaded succesfully. I look at the other templates in the files I have and they are all direct copies from the templates section of the msdn site, the only difference between them and meshmaterial list is the additional uuid. This is from msdn;

template MeshMaterialList
{
< F6F23F42-7686-11CF-8F52-0040333594A3 >
DWORD nMaterials;
DWORD nFaceIndexes;
array DWORD faceIndexes[nFaceIndexes];
[Material <3D82AB4D-62DA-11CF-AB39-0020AF71E433>]
}

I cannot find this duplictaed in the files I have, instead the material list section just follows this format of array without declaring the template
So Ive added it in in various palces but its an always fail to load result. Ive tried removing the second uuid(the first one in all template cases are fixed and dont need generating) and also replacing it with 1 generated from GuidGenerator.exe(visual basic should have this already if you have it installed, its also available as standalone from internet). I dont even know if x file support additional dimension of array or obviously if direct x will read the data and do something useful with it. But to get to that test I need to declare the template which has me stuck - Anybody got any ideas?

*disclaimer, my bad explanations are always to be expected..

EDIT @GG I couldnt help notice how the fvf codes do not match dbp fvf codes, additonal texture stages increase by 256 each time in the x file fvf code like in dbp, a single textured layered mesh has no fvf declaration in the x file and 1 additonal layer is 258 so weirdly we start off with an fvf of 2 in the xfile even though we don`t see it?
EDIT2
template MeshMaterialList {
<F6F23F42-7686-11cf-8F52-0040333594A3>
DWORD nMaterials;
DWORD nFaceIndexes;
array DWORD faceIndexes[nFaceIndexes][1];
[Material]
} so multi dimensions work like this and having this in x file still allows it to load, but how to access the extra dimension? Also if templates can be user defined but the readback of the data is set - how does one change this? What would otherwise be the point of being able to alter the template without a method to link the data when reading it back?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Aug 2014 03:28
Quote: "I cannot find this duplictaed in the files I have, instead the material list section just follows this format of array without declaring the template"


Standard templates often seem to be missing from X files. In fact I've noticed that you can often remove them from the X file and DBPro will still load the file correctly.

If you're adding a template you need to be very careful it is copied correctly and matches the data layout in the X file. I usually copy a template from a file that is known to work - when I bother to use one.

Quote: "@GG I couldnt help notice how the fvf codes do not match dbp fvf codes, additonal texture stages increase by 256 each time in the x file fvf code like in dbp, a single textured layered mesh has no fvf declaration in the x file and 1 additonal layer is 258 so weirdly we start off with an fvf of 2 in the xfile even though we don`t see it?"


Yes, that sounds like the discrepancy I mentioned earlier.

Quote: "Also if templates can be user defined but the readback of the data is set - how does one change this? What would otherwise be the point of being able to alter the template without a method to link the data when reading it back?"


I've often wondered exactly the same thing - and where would you get your UUID from?

I'm not sure the X file format allows you to specify multi-materials to secondary UV stages - at least I've never seen a reference to it.



Powered by Free Banners
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Aug 2014 04:01 Edited at: 19th Aug 2014 04:04
Well this is beyond me, I can edit the file in notepad to make changes and understand most of what I`m looking at but I dont understand why I cannot find anywhere where it says this cant be done or anywhere it says it can be done. The main reason I dont understand this is it would seem an obvious next step to have more submeshes separate for 2nd texture stage. The msdn site is useful but only ever provides bare minimum of information though the cube sample was simple enough to understand, also used these links as well as many dead end results from google searches
http://xboxforums.create.msdn.com/forums/t/111638.aspx
http://paulbourke.net/dataformats/directx/#xfilefrm_UUID

@Brendy boy
In the thread "What Can We Do To Fix DB Pro" you said
Quote: "In direct x you can have a mesh were each poly has its own texture. In dbpro you can't. If you want 200 textures in you level that means 200 limbs.
Yes, you can import .x object with multitextures but you can't change any texture afterwards and the real problem arouses when you need to apply normal map to 2nd layer of every poly in a level. In dbpro you just can't do that without introducing crapload of additional limbs. In a serious development which inludes shaders thats a real show stopper"

Is this in reference to being able to have 2 groups of submeshes 1 lot for texture stage 0 as diffuse and the other lot for texture stage 1 as normal maps? I assume then you have seen a working example? Could you please elaborate? Apart from the obvious reason of wanting this to be true I`m asking as you seemed unaware of multiple uvs in the x format so am wondering if your statement is in reference to a system that might employ additional meshes internally for the second lot of normal mapped submeshes instead of the same mesh as the first lot of diffuse submeshes. Don`t get me wrong, I am not pertaining to make some form of charactor judgement - I can see why you thought the format didnt support fvf uv`s as the data is not stored in mesh data but in fvf data and isnt immmediatly obvious that the additional uv data needs converting to float. Im simply trying to ascertain if this is possible outside of dbp but with 100% certainty that what your refering to couldnt have been a misunderstanding, for all I know you may have already coded this yourself in different language.
I already have enough info to be able to make say 2 identical meshes in blender one with diffuse submesh textures and 1 with normal map uvs for an atlas(they can be hidden and shown by scene in blender to make editing easy), export both as .x then load the diffuse as object and parse the normalmap mesh file for uv data and transfer to diffuse object via vertexdata commands AND/OR write a process to create a new xfile from the 2 exported. I can at least get on with tests to see how useful this will be for me.
Regarding my thoughts mentioned early on in this thread about trunks looking better wrapped rather than a big atlas used in clamp mode - this is now solved - easily might I add, didnt occur to me til today to simply imagine the trunk in 2d and fold back/flip over the uv coords, bit like folding paper into a fan then placing it on texture. Maddening thing is Ive done this before but completely forgot about it due to extended periods away from developement. Would be neat though if the 2nd uv submesh stuff was possible and worked in dbp, but I accept it may not be possible or even that its uses might be limited.
Got to say though that learning from the format has been enjoyable, enlightening and very useful. I will do rest of vertexdata/multiple uv layer mesh tests now and then get back to my main tests.

EDit GG missed your post while I was posting - reading it now
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Aug 2014 04:31 Edited at: 24th Aug 2014 03:42
Quote: "Standard templates often seem to be missing from X files. In fact I've noticed that you can often remove them from the X file and DBPro will still load the file correctly."

Thought this might be the case, writing a new x file in dbp code will prove useful exercise in this matter
Quote: "If you're adding a template you need to be very careful it is copied correctly and matches the data layout in the X file. I usually copy a template from a file that is known to work - when I bother to use one."

Yes, I found this out the hard way!
Quote: "I've often wondered exactly the same thing - and where would you get your UUID from?"

GuidGenerator.exe, if you have visual basic apparently its a tool in there - if not I got mine here;
http://guid.codeplex.com/releases/view/47385
I get the impression x files arent limited to graphical stuff, Ive spotted the odd example for other things like a file system for example, maybe this is only real use of your own templates, havent looked into it to much but I could swear I saw code that was sound orientated, wether it was a section of the x file or the entire x file Im unsure, but x file is just a format so makes sense to me other direct x related stuff could be supported
Quote: "I'm not sure the X file format allows you to specify multi-materials to secondary UV stages - at least I've never seen a reference to it."

Well Im even less sure than you !!! The lack of any reference is what bothers me most, sometimes this simply means soemthing isnt possible, other times it means I havent looked hard or long enough!

EDIT: seems I was wrong about x format supporting non graphic stuff, found link again and I missed it was another x file format for a different language (lex)
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Aug 2014 07:05
Apologies for triple post - 8 uvs are same results as previous tests, didnt bother with 5,6 or 7 uvs. Only fail was as expected when loading the x file as object. Vertex data uv control was also flawless with lockmode 0, again no difference between shader tests or blendmap tests only annoying thing was having to use near black throughout images to satisfy (additive)blend shader so I could see all the textures!

I noticed in the x file you can ommit poly`s by simply changing the meshmateriallist data for a selected face by simply giving it the attribute of a non existing material ie if you have 4 materials then you can use attribute 4(as materials indexed from 0), I mention this as I can think of one or two uses and also could possibly have some bearing on the bug report you mentioned, IDK as Ive only breifly read through it and am so tired I switched off at the mention of tangents and binormals lol
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Aug 2014 12:56
Quote: "The lack of any reference is what bothers me most, sometimes this simply means soemthing isnt possible, other times it means I havent looked hard or long enough!"


Indeed.

The one positive thing out of all this is that load mesh seems to work.



Powered by Free Banners
Brendy boy
18
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Aug 2014 02:15
Quote: "@Brendy boy
In the thread "What Can We Do To Fix DB Pro" you said
Quote: "In direct x you can have a mesh were each poly has its own texture. In dbpro you can't. If you want 200 textures in you level that means 200 limbs.
Yes, you can import .x object with multitextures but you can't change any texture afterwards and the real problem arouses when you need to apply normal map to 2nd layer of every poly in a level. In dbpro you just can't do that without introducing crapload of additional limbs. In a serious development which inludes shaders thats a real show stopper"
Is this in reference to being able to have 2 groups of submeshes 1 lot for texture stage 0 as diffuse and the other lot for texture stage 1 as normal maps? I assume then you have seen a working example? Could you please elaborate? Apart from the obvious reason of wanting this to be true I`m asking as you seemed unaware of multiple uvs in the x format so am wondering if your statement is in reference to a system that might employ additional meshes internally for the second lot of normal mapped submeshes instead of the same mesh as the first lot of diffuse submeshes. Don`t get me wrong, I am not pertaining to make some form of charactor judgement - I can see why you thought the format didnt support fvf uv`s as the data is not stored in mesh data but in fvf data and isnt immmediatly obvious that the additional uv data needs converting to float. Im simply trying to ascertain if this is possible outside of dbp but with 100% certainty that what your refering to couldnt have been a misunderstanding, for all I know you may have already coded this yourself in different language."

i don't know what you mean by "submesh".

What i meant it that other thread is that in direct x you can have a mesh with N number of polys where each poly can be rendered with a different set of textures (up to 8 layers where each layer can have different uv coords). In dbpro you can only render a limb with different set of texturs (8 layers) but every poly inside a limb will have the same set of textures (or you can load a pretextured object where each poly can have only one texture layer. If there can be more i don't know because i haven't seen any example of that but i have seen dbpro source code and based on that i'm quite sure that it can't).
I don't know if you can create a .x file that contains a mesh where each poly has different set of textures and i also don't know if you can specify different uv coords for every texture in a set for each poly. I experimented with that many years ago but direct x documentation wasn't very good in that subject and i could find any info on google on that subject.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th Aug 2014 02:34 Edited at: 20th Aug 2014 02:36
@Brendy boy - You are misinformed. You cannot bind textures to individual polygons, only to submeshes (in DBP submeshes are essentially limbs).

Binding textures is an extremely expensive process. Game engines will try to batch geometry that share the same texture into groups in order to make sure every image is only uploaded to the GPU once.

Using 200 separate textures for each polygon in a mesh (where each polygon would be a submesh) is stupid and not something anyone would do.

James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Aug 2014 05:07 Edited at: 6th Jul 2017 17:02
Thanks for the reply Brendy boy, much appreciated

TheComet thanks for weighing in here, I can see now how I have been going in circles due to my lack of understanding and far to many assumptions that I made, as you can tell Im not the brightest of sparks lol

I think its fair to say that wraps this up for me, its been fun examining the x file format and I now have a better understanding. Has helped me understand a little more on shaders and if nothing else I now know how to ommit polygons at the cost of the extra limb.

Thankyou everybody for your effort and time, TGC commmunity is as has always been - awesome.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Aug 2014 13:19
Quote: "@Brendy boy - You are misinformed. You cannot bind textures to individual polygons, only to submeshes (in DBP submeshes are essentially limbs)."


Of course you can as we've discussed several times before in this thread - and it's very simple to do using the material list in the X file. Unless you mean something very special by "bind textures" that I am not aware of.



Powered by Free Banners

Login to post a reply

Server time is: 2024-05-02 22:22:16
Your offset time is: 2024-05-02 22:22:16