|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Sun Dec 23, 20:57 |
|
|
@ Black F:
I ve downloaded jongl's track made with one of BTB last version. He uses too one of your last version of rbr_rx.dll. look into his directories inspires me some remarks:
before, with older plugin there was a directory called "Xfiles", now it seems to be called "objects".
before my objects files exported from 3ds was called toto.x (for example) and there was only one file .xform (track.xform) for all the .x files. Now it seems that for each files .x we need a .xform. My question is: Is there a way to create those .xform files for my .x files made with 3ds That's in order to use your last plugin and to keep my work made during 2 months
|
|
|
Back to top
|
|
|
black f.
Joined: 10 Apr 2005
Posts: 880
|
Posted: Sun Dec 23, 21:19 |
|
|
xform contains the object matrix. (aka position, rotation, scale).
if the object you use has no rotation, it has scale 1 on all axis and it has position
0,0,0 it means it has "identity" matrix.
you can clone the xform from the attached zip and use it for any fixed object.
the xform name should be the same with xfile's name
Code: |
macroScript XFORM category:"RBR"
(
if(0 != selection.count) then
(
m = selection[1]
if(undefined != m) then
(
matrix = m.transform
output_name = getSaveFileName caption:"xform file" types:"xform (*.xform )|*.xform"
if (undefined != output_name) then
(
f = fopen output_name "wb"
if(undefined != f) then
(
writefloat f matrix.row1[1]
writefloat f matrix.row1[2]
writefloat f matrix.row1[3]
writefloat f (0.0 as float)
writefloat f matrix.row2[1]
writefloat f matrix.row2[2]
writefloat f matrix.row2[3]
writefloat f (0.0 as float)
writefloat f matrix.row3[1]
writefloat f matrix.row3[2]
writefloat f matrix.row3[3]
writefloat f (0.0 as float)
writefloat f matrix.row4[1]
writefloat f matrix.row4[2]
writefloat f matrix.row4[3]
writefloat f (1.0 as float)
fflush f
fclose f
)
)
)
)
)
|
identity.zip - 137 KB 30 Time(s)
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Sun Dec 23, 21:40 |
|
|
Ok i'll try to use your last plugin with my old .x and your explanations.
Thanks you again black f for all your help !!!! And Merry Christmas !!!!!
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Sun Feb 17, 18:29 |
|
|
I work on my track since almost 4 months with 3ds. I use your may 2007 plugin with not many problems, but now i'd like to use your last with new pacenotes and split time.
I have some question for you black f. if you have some time to write me back an answer:
1 - First, where can we get your last plugin without having BTB?
2 - Since some version of your plugin, .x structure seems to have changed. and now i can't open with notepad the .X made with BTB found in this forum !
I use panda exporter to create my .X: do you know an exporter for 3ds whitch can create the same kind of .x as BTB?
3 - Questions about materials.ini: for the moment i'm not familiar with light effects in 3ds. What have I to put in this file to declare my materials and set "no effect"?
4 - Questions about driveline.ini: in 3ds i have a line made with points placed along my track in the middle of the road (=my driveline)
I've tried to write manualy the driveline.ini but i don't understand all the data found in examples:
Kn = X , Y , Z , ? , ? , ? , distance from the beginning , 0
What have I to put instead of the "?" ? (I thought that it was a kind of vector between Kn-1 and Kn ?)
5 - With your new plugin, in what file(s) do the split time and end time points appear ? (= where are they declared ?)
I don't know if i was clear (sorry for my english ). I hope you will understand my questions and i hope too i'm not to boring writing stupid questions .
Thank you for all your help Black f.
|
|
|
Back to top
|
|
|
black f.
Joined: 10 Apr 2005
Posts: 880
|
Posted: Sun Feb 17, 21:21 |
|
|
1. the last plugin is the one from BTB Demo which is free.
2. the x file structure didn't changed, x files can be saved as both text and binary, you've probably opened a binary xfile.
however, not all the xfiles are the same, the mesh format itself, better say the vertex format of a mesh depends on the effect[material] so don't expect to see the same thing in all x files.
in any case, if you feel you need to open a xfile with ntepad you are on a wrong path.
to render a mesh in plugin you also need an effect file for it. inside this effect file you can find the vertex format which will look something like:
float3 pos : POSITION
float3 N : NORMAL
float2 uv0 : TEXCOORD0
float3 T : TANGENT
float3 B : BINORMAL
float2 uv1 : TEXCOORD1
float2 uv2 : TEXCOORD2
(from BTB_DiffuseBumpSpecular.fx - BTB Demo).
you can see this effect requires position, normal, binormal, tangent and 3 uv channels per vertex.
this is all you need to know about the mesh format, if panda lets you export those elements in your mesh then you can use the above mentioned fx in your material.
3. everything in plugin is rendered through an effect so "no effect" gets you nowhere.
4.you are quite close, those missing parts are the out tangent vector and the distance.
this is the c++ code for writting the driveline, is quite similar with maxscript:
Code: |
Spline3D * pSpline = pShape->splines[0];
int knotCount = pSpline->KnotCount();
int segmentCount = pSpline->Segments();
Matrix3 atm = pNode->GetNodeTM(ip->GetTime(),NULL);
float length = 0.0f;
char knotCountStr[64];
sprintf(knotCountStr, "%d\0", knotCount);
WritePrivateProfileString("DRIVELINE", "count", knotCountStr, ofn.lpstrFile);
for(int k = 0; k < knotCount; k++)
{
SplineKnot aKnot = pSpline->GetKnot(k);
Point3 inV = aKnot.InVec() * atm;
Point3 outV = aKnot.OutVec() * atm;
Point3 pos = aKnot.Knot() * atm;
if(k == (knotCount - 1))
{
outV = 2.0f * pos - inV;
}
outV = outV - pos;
outV *= 3.0f;
if(k > 0)
{
length += pSpline->SegmentLength(k - 1);
}
char floatstr[128];
memset(floatstr, 0, 128);
sprintf(floatstr, "%.5f, %.5f, %.5f, %.5f, %.5f, %.5f, %.5f, 0\0",
pos.x, pos.y, pos.z, outV.x, outV.y, outV.z, length);
char keystr[16];
sprintf(keystr, "K%d\0", k);
WritePrivateProfileString("DRIVELINE", keystr, floatstr, ofn.lpstrFile);
}
|
5. the start, finish, end and the 2 checkpints are the same as pacenotes and they go in pacenotes.ini as well.
some time ago i've posted here a maxscript to edit and write the pacenotes.
forum search is not working apparently so i'll attach it here.
the script should go in max_folder\Scripts\startup\.
the script code may have some missing bits[the flags] but here is the list of types and flags, feel free to complete the code.
types:
0 = hairpin left
1 = 90 left
2 = k left
3 = medium left
4 = fast left
5 = easy left
26 = flat left
6 = easy right
7 = fast right
8 = medium right
9 = k right
10 = 90 right
11 = hairpin right
25 = flat right
12 = twisty
13 = call distance
15 = flat right
16 = overcrest
17 = ford
18 = caution
19 = bump
20 = jump
21 = start
22 = end
23 = check
24 = finish
27 = bridge
28 = go straight
29 = keep right
30 = keep left
31 = keep middle
32 = caution water
flags:
32 = 0x00000020 = don't cut
64 = 0x00000040 = cut
1024 = 0x00000400 = long
2 = 0x00000002 = wideout
1 = 0x00000001 = narrows
4 = 0x00000004 = tightens
128 = 0x00000080 = tightens bad
8192 = 0x00002000 = maybe
even the old plugin versions should load the paces and the driveline, but as i've said it will make more sense to use what cames with BTB.
there is a max exporter which i've used to test things but since there are many different versions of 3dsmas is quite a hassle to get it working for everybody.
the good "news" is am working on some sort of "track manager" which should allow modifying mesh formats, materials and such - some sort of dry-runner for the rxtracks.
i hate promising but i guess a basic working version of this will be ready in 2 weeks, and again, is not a max related tool but a manager of rxtrack files, it should let you also add materials and meshes to a track in a easier way.
there are 2 reasons you find the plugin only with BTB, first is the chaos which releasing few different max exporters will create and the second and most important is the fact Piddy gives a great deal of technical and moral support.
when you're used to max only i know BTB may not seem a easier way around but i also know for a fact it is way harder to deal with the same mesh creation and material management in max alone no matter how powerfull features it may have
so don't expect this to change anytime soon.
sorry for the "novel", i hope i've cleared your questions.
pacenote_ed.rar - 100.51 KB 13 Time(s)
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Mon Feb 18, 00:43 |
|
|
Ok, thank you for your detailled answer!
I need some time to translate and understand all your explainations, but i'm sure it will be very helpful for me, and maybe soon i may have a lot of new questions for you
I'll take a look tomorrow evening when i get back home...
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Mon Feb 18, 10:19 |
|
|
I've got some minutes to test your pacenote_ed this morning. It seems to be very helpful and easy to use but i can't find a way to write automaticly the pacenotes.ini: i have to write it manualy or i miss something?
|
|
|
Back to top
|
|
|
black f.
Joined: 10 Apr 2005
Posts: 880
|
Posted: Mon Feb 18, 19:23 |
|
|
yes, you can add a button to that rollup and add a handler to it or code a separate script.
you have the path node, all you need for pacenotes is to get every child of that path node [all the boxes] and get the type, flag and distance from userprops.
for aBox in path.children do
(
distance = getUserProp aBox "distance"
type = getUserProp aBox "type"
.....
//print to ini
)
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Tue Feb 19, 01:48 |
|
|
ok, i'm happy : i've reached to modify your code adding a button which create automaticly pacenotes.ini with a correct structure (i'm really proud of me )
Tomorrow i'll try to complete it with all the missing flag...
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Thu Feb 21, 00:45 |
|
|
All the things I have added to your script work now: now I can create automaticly pacenotes.ini and driveline.ini (even if i'm not really sure to have understood what is the "out tangent vector" and how to calculate it), and they both work with plugin version i'm using for the moment (may 2007), except "flag": codriver always says "in" when "flag" is set =0 and says nothing when is set with other value. Don't know why (maybe because of the plugin version i use?).... check, end and finish work perfectly.
Thank for your help in script, you save me from hours of boring manual .ini write !!!
So my points 1, 4 and 5 are almost cleared.
for my point 3, i understand "no effect" is impossible, a material need at least a "diffuse color". so for a material "tarmac", for example, with only diffuse color "tarmac.dds", have i only to set in the materials.ini : ?
Code: |
[--\tarmac]
effectName=Diffuse
AmbientLight=--,--,--
specularpower=--
specularcolor=--,--,--
diffuseTexture=D:\...\tarmac.dds
|
Am i right? (of course completing the -- with the right values)
Can we say that if i can run my track made with .x exported with panda and see textures, then i can use other effect?
Is there a correspondance between effects you propose with your plugin and effects we can use in max materials editor (don't know if i'm really clear...)?
|
|
|
Back to top
|
|
|
black f.
Joined: 10 Apr 2005
Posts: 880
|
Posted: Thu Feb 21, 14:35 |
|
|
you don't need to calculate the vector from scratch, you "get" it from spline, see the attachment.
about the materials, i understand you are looking for a way to export the properties of a standard material from max to rx material but unfortunately there is no 1/1 corelation.
rx material has a flexible list of parameters which depends on the effect used.
there are mainly 2 ways out of this, first is to use your own fx as material in max
as i've explained here:
https://bhms.racesimcentral.net/board/viewtopic.php?t=44524&postdays=0&postorder=asc&start=15
the second way is to use an fx which is 1/1 representation of the standard material itself. the good news is max itself can export such fx file from the material editor itself - see the second attachment.
the "bad" news is the fx from max will most probably need some changes or i should need to change the plugin to handle the max fx. one other problem is max will generate different fx from different materials so you cant really count on a "standard" fx for any max material.
long story short, you better focus on using custom fx in max as i've told you in the other thread. if you manage to get that working i may have a script for exporting such materials
|
|
Description: |
Size: 74.1 KB |
Viewed: 59 Time(s) |
driveline.rar - 858 KB 10 Time(s)
|
|
|
Back to top
|
|
|
cricrikris
Joined: 30 Oct 2006
Posts: 30
|
Posted: Fri Feb 22, 00:27 |
|
|
For the driveline and the outvect, i was quite close, it worked but my outvect were wrong (i forget the *3 operation ). I saw in your code my mistake and now i use directly yours with a write in .ini fonction (yours is better coded
)
about the materials and max fx i'll take a look next week. It seems to be complex but really interesting to improve track graphism. Surely many questions for you in a near future
|
|
|
Back to top
|
|
|
black f.
Joined: 10 Apr 2005
Posts: 880
|
Posted: Fri Feb 22, 02:38 |
|
|
at the end of this
https://www.gamasutra.com/features/20060524/puech_01.shtml
article you can see a small script code which gives you pretty much all you need to know to export a fx based material, and yes is as simple as that.
Code: |
-- Loop over scene materials
for mtl in sceneMaterials do
(
-- DxMaterial?
if(Classof mtl == DirectX_9_Shader) do
(
-- Get current technique
CurrentTechnique = mtl.technique
EffectFile = mtl.effectfile
-- Get used bitmap(s) in the effect
for i = 1 to mtl.numberofbitmaps() do
(
bmp = mtl.geteffectbitmap i
BmpFileName = bmp.filename
)
)
) |
there are few more properties you can access from the DirectX_9_Shader but there is a little trick which can do alot of "dammage" , you can access ALL the material properties needed for rx exporting by simply dumping the material rollout properties:
Code: |
macroScript FXMATERIALS category:"RBR"
(
for mtl in sceneMaterials do
(
format "%\n" mtl
-- DxMaterial?
if(Classof mtl == DirectX_9_Shader) do
(
CurrentTechnique = mtl.technique
format "%\n" CurrentTechnique
EffectFile = mtl.effectfile
format "%\n" EffectFile
propNames = (getPropNames mtl)
for p in propNames do
(
format " %: " p
prop = getProperty mtl p
format " %\n" prop
)
-- Get used bitmap(s) in the effect
for i = 1 to mtl.numberofbitmaps() do
(
bmp = mtl.geteffectbitmap i
BmpFileName = bmp.filename
channel = mtl.bitmapmappingchannel i
usage = mtl.bitmapusage i
format "%: %\n" usage BmpFileName
)
)
format "#######################\n"
)
)
|
this code produces something like this:
01 - Default:DirectX_Shader
0
F:\Richard Burns Rally\RX_CONTENT\TRACKS\test\FX\DiffuseBumpSpecular.fx
#effectfile: F:\Richard Burns Rally\RX_CONTENT\TRACKS\test\FX\DiffuseBumpSpecular.fx
#technique: 0
#renderEnabled: false
#renderMaterial: DiffuseBumpSpecular_renderstyle:Standard
#lightDir: 0
#diffuseTexture: BitMap:C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_d.dds
#diffuseTexturemapChannel: 1
#normalTexture: BitMap:C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_n.dds
#normalTexturemapChannel: 1
#specularTexture: BitMap:C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_s.dds
#specularTexturemapChannel: 1
#ambientColor: (color 102 102 102)
#specularcolor: (color 255 255 204)
#gloss: 8.0
#specularLevel: 1.0
#bumpHeight: 1.5
#effectFilename: F:\Richard Burns Rally\RX_CONTENT\TRACKS\test\FX\DiffuseBumpSpecular.fx
#softwareBitmap: undefined
#diffuseMap: C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_d.dds
#NormalMap: C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_n.dds
3: C:\DIRT_TEXTURES\UK_1\New Folder\ia1\kie_01_ia1_s.dds
################################################
sems alot but this effect i've dumped really has that many parameters as you can see in the screenshot.
|
|
Description: |
Size: 79.02 KB |
Viewed: 36 Time(s) |
|
|
|
Back to top
|
|
|
|