Author |
Topic: Wavefront OBJ to FVF converter (Read 491 times) |
|
michael
Full Member
member is offline


Posts: 157
|
 |
Re: Wavefront OBJ to FVF converter
« Reply #5 on: Sep 16th, 2017, 1:22pm » |
|
Richard, it isn't the files that are at issue. The HELP section in BBC4W, when accessing direct 3D uses the B3D format. I am sure it was just overlooked by DDRM as it wasn't the focus of the goal to make the tools.
I can focus on the FVF extension if there is an issue concerning the other extension. Like with languages, I doubt that a file format can cause issues, aside from giving attention to the other Basic platform.
BBC Basic is far easier than the other language you mentioned.
Also I must say, your work on that converter is a fantastic creation. I have been looking for an OBJ converter for basic for years. (since around 2009
And it really is no big issue, as I see that the code you supplied for FVF and B3D examples are identical:
Code: DEF PROCcreate3d F% = OPENOUT"TRIANGLE.B3D" PROC4(3):REM 3 vertices PROC4(&100042):REM vertex size &10 and format &42 REM LL x LL y LL z LL colour PROC4(FN_f4(-1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF) REM LR x LR y LR z LR colour PROC4(FN_f4(1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF00FF00) REM PEAK X PEAK Y PEAK Z Peak colour PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(&FFFF0000) CLOSE #F% ENDPROC : DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC Code: F% = OPENOUT"TRIANGLE.FVF" PROC4(3):REM 3 vertices PROC4(&100042):REM vertex size &10 and format &42 PROC4(FN_f4(-1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF) PROC4(FN_f4(1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF00FF00) PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(&FFFF0000) CLOSE #F% DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC
|
| « Last Edit: Sep 16th, 2017, 1:45pm by michael » |
Logged
|
I like reinventing the wheel, but for now I will work on tools for D3D
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Wavefront OBJ to FVF converter
« Reply #6 on: Sep 16th, 2017, 1:45pm » |
|
on Sep 16th, 2017, 1:22pm, michael wrote:| Richard, it isn't the files that are at issue. The HELP section in BBC4W, when accessing direct 3D uses the B3D format. |
|
There is no such thing as "B3D format" (or, if you prefer to look at it this way, it's the format of Blitz 3D object files which isn't used by BBC BASIC). Admittedly the code example in the Help file creates a file with the .B3D extension but it's not the extension that defines the file's contents - it's how you create the file! The extension could be anything at all and it would still work.
I don't see what I could have done differently, other than not making the (stupid) mistake of misusing the B3D extension in the first place. Obviously I hugely regret that mistake, as I do the many other stupid decisions that I made when originally creating BB4W. It's one reason why it would have been far better if BBC BASIC for Windows had never existed.
But I did make those mistakes and it's something I have to live with every day (or perhaps not live with, and that's an option I consider every day too). All I can do now is to attempt to put things right as far as possible by no longer using the misleading B3D extension, but you seem to think that is yet another mistake. Argggh!!!!
Richard.
|
|
|
|
michael
Full Member
member is offline


Posts: 157
|
 |
Re: Wavefront OBJ to FVF converter
« Reply #7 on: Sep 16th, 2017, 1:57pm » |
|
Quote:| but you seem to think that is yet another mistake |
|
Its not a mistake. (you shouldn't have had to change the extension) It was a coincidence. Everything is ok.
I wish I could be at your skill level. And BBC4W is a fine product.
|
| « Last Edit: Sep 16th, 2017, 2:22pm by michael » |
Logged
|
I like reinventing the wheel, but for now I will work on tools for D3D
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Wavefront OBJ to FVF converter
« Reply #8 on: Sep 16th, 2017, 4:29pm » |
|
on Sep 16th, 2017, 1:57pm, michael wrote: I can't claim that excuse. Before adopting the B3D extension I should have looked it up on a site like filext.com (quite different then from what it is now) when I would have discovered its existing use(s).
Richard.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Wavefront OBJ to FVF converter
« Reply #9 on: Sep 17th, 2017, 09:06am » |
|
Has anybody else tried the Nottingham University 3D Face Reconstruction tool? It's very easy to use:
Find a full-face straight-on selfie (preferably without glasses), with good contrast between your face and the background, and upload it here.
When it has finished processing, download the generated .OBJ file and convert it to a .FVF using the code I listed previously in this thread.
Plug the FVF file into the program below if you want to use the same animation as I did for Donald Trump, or adapt it to your preference.
Upload a video capture to YouTube (etc.), so we can see the result, if you dare! Richard.
Code: REM. Turning Face by Richard Russell, 16-Sep-2017 HIMEM = PAGE + 5000000 IF INKEY$(-256)="W" INSTALL @lib$+"D3DLIBA" ELSE INSTALL @lib$+"ogllib" ON CLOSE PROCcleanup : QUIT ON ERROR PROCcleanup : IF ERR=17 CHAIN @lib$+"../examples/tools/touchide" ELSE MODE 3 : PRINT REPORT$ : END ON MOVE IF @msg% <> 5 RETURN ELSE PROCcleanup : CLEAR VDU 20,26,12 DIM pVB%(0), nv%(0), vf%(0), vl%(0), l%(0), m%(0), t%(0), y(0), p(0), r(0) DIM X(0), Y(0), Z(0), eye(2), at(2) REM. Initialise OpenGL: IF INKEY$(-256)="W" pDev% = FN_initd3d(@hwnd%, 1, 0) ELSE pDev% = FN_initgl(@hwnd%, 1, 0) IF pDev% = 0 ERROR 100, "Couldn't initialise 3D subsystem" REM. Load 3D object: pVB%(0) = FN_load3d(pDev%, @dir$ + "trump.fvf", nv%(0), vf%(0), vl%(0)) IF pVB%(0) = 0 ERROR 101, "Couldn't load FVF file" REM. Render the turning face: at() = 100, 100, 40 REPEAT turn = SIN(TIME/100) eye() = at(0)+400*SIN(turn), 0, at(2)+400*COS(turn) PROC_render(pDev%, &7F7F90, 0, l%(), 1, m%(), t%(), pVB%(), nv%(), vf%(), vl%(), \ \ y(), p(), r(), X(), Y(), Z(), eye(), at(), PI/6, @vdu%!208/@vdu%!212, 1, 1000, PI) UNTIL INKEY(1)=0 END DEF PROCcleanup pVB%(0) += 0 : IF pVB%(0) PROC_release(pVB%(0)) *REFRESH ON ENDPROC
|
|
|
|
|