Author Topic: First CVR mod!  (Read 15632 times)

0 Members and 3 Guests are viewing this topic.

Online Buster's Uncle

  • In Buster's Orbit, I
  • Ascend
  • *
  • Posts: 49271
  • €440
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: CVR Progress - Now with images!
« Reply #15 on: February 26, 2014, 10:55:39 PM »
Actually, it would be more like spray painting the desired image onto the model using the palette colors.  Not sure what a different color palette would do to the object models in the game.  They both use a 256 color palette.  If you change the games color palette, does it change the colors of the units as well or does the game just crash?
I believe you get an LSD trip, but no crash.

Online Buster's Uncle

  • In Buster's Orbit, I
  • Ascend
  • *
  • Posts: 49271
  • €440
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: CVR Progress - Now with images!
« Reply #16 on: February 26, 2014, 10:58:29 PM »
I'd love to see Dio kibbitz with you - he's and excellent art modder who is also the haxxor.

Kilkakon is also a fantastic artist who actually altered the pallet for his mod.  I do the art, but the tech stuff with the pallet is outside my interests.

Offline Ford_Prefect

Re: CVR Progress - Normals. Help.
« Reply #17 on: February 27, 2014, 07:28:40 PM »

Long version:
(click to show/hide)


Short Version:
I would really like it if someone else figured out the normals in the CVR file format as they are driving me nuts.
If no one does, I'll still be able to export the models to other programs, it just won't have the correct reflections on it.  (I'll whip up a formula to get it somewhat correct normals). 
If you do decide to take a shot at figuring it out, please tell me! 

Offline Dio

Re: CVR Progress - Now with images!
« Reply #18 on: March 01, 2014, 02:33:19 AM »
When you say shininess, do you mean how the light looks after striking the caviar parts? As far as I know, the game grabs the vector value that determines how the vehicles are lit and thus shininess from the #VEH_LIGHT_DIR_MAP in the system.txt file. I imagine the first number controls what value goes into x, the second y and the third z. You can find the coding for said feature starting at address 00451953. I hope this helps somewhat. I am unfamiliar with the exact mathematical formulas you might use (in particular, the trigonmetric formulas). However, I am willing to help you in any that I can within my present time constraints.
« Last Edit: March 01, 2014, 02:50:48 AM by Dio »

Offline Ford_Prefect

Re: CVR Progress - Now with images!
« Reply #19 on: March 01, 2014, 03:37:22 AM »
I meant the normals.  http://en.wikipedia.org/wiki/Normal_%28geometry%29.  Normals tell the 3d renderer how light reflects off of an object.   So as the object is rotated, the correct parts reflect the light.  I should of used better terminology in my previous post.  If I don't have normals, the object will appear flat if it uses only one color.  You can't tell where corners are at, see overlapping parts, etc.

I wish I had paid attention back when I was a CS major (I switched) when we did reverse engineering.... I don't remember anything.   :-P  I would have to start from scratch.

Ok.  Here are my current notes on the CVR file format.  Not complete and probably wrong in several places. :-D  I'll post my code and an updated specification when I get all the models loading their geometry correctly.
(click to show/hide)

On the request for assistance,  helping me pinpoint which bits are used for the normal lookup would be very helpful.  The normals are stored with the voxel points.  In the notes I've identified the voxel lookup bits, and 3 of the bits used to identify the normals.  If someone could even find out which other specific bits are also part of the normal reference number, it would help me significantly. 

Offline Ford_Prefect

Re: CVR Progress - Milestone Reached!
« Reply #20 on: March 03, 2014, 12:07:42 AM »
Made some more progress today!

All (I think) single part non-animated files I can now load their geometry and their colors.
Also, I reworked the code to make it much more reliable and readable. 

Todo:
  • Read in non-animated multi-part objects (aka, the terraformer)
  • Read in animated single part objects
  • Read in animated multi-part objects
  • Figure out what to do about normals

This image below shows why normals are important. :-D   Allot of the units are only 1 or 2 colors.  (As usual, the smaller bottom right image is what it's supposed to look like)
(click to show/hide)

EDIT:
Ick.  Just found a file that the colors are wrong on.... sigh.  Need to figure out what I assumed wrong this time.  ::)
« Last Edit: March 03, 2014, 02:16:20 AM by Ford_Prefect »

Offline Geo

Re: CVR Progress - Milestone Reached!
« Reply #21 on: March 03, 2014, 05:34:56 PM »
EDIT:
Ick.  Just found a file that the colors are wrong on.... sigh.  Need to figure out what I assumed wrong this time.  ::)

Which file? Perhaps its a non-used one?

Offline Ford_Prefect

Re: CVR Progress - Now with images!
« Reply #22 on: March 03, 2014, 09:34:16 PM »
Bad news:  I decided to take a gander at normals.

Unless I'm mistaken, all 11 bits are being used for the normal data.  11 bits means 2048 possibilities.   :-\

Yeah, I'm not gonna be able to figure them out by brute forcing it.  I've looked at a good number of points and no useful patterns are appearing.

Any ideas?

« Last Edit: March 03, 2014, 10:09:08 PM by Ford_Prefect »

Offline Ford_Prefect

Re: CVR Progress - 2048 normals... :-(
« Reply #23 on: March 04, 2014, 02:53:56 AM »
Oh.  Just found out some good news.   :D I just tried my code on select.cvr which is a single part animated file... and it worked (except for the colors were slightly off).   ;) 

I did some more looking at normals... and I'm not seeing any patterns that I could use to solve it.   :(

Help.  I can't solve normals by slowly modifying values and seeing what changes.... not when there are up to 2048 possible values and in 8-10 degree increments.  :(  (especially not at the resolutions I'm having to deal with)



Other news....
I'm gonna examine multipart files next and try to figure out how they are put together.
Then all I have left is getting the colors correct and
normals.  :( 


Offline Ford_Prefect

Re: CVR Progress - 2048 normals... :-(
« Reply #24 on: March 05, 2014, 05:07:48 PM »
Ok.  This is just weird.  I figured out where the color is going wrong.
Palette code 236.  All the other colors are correct, but sometimes the file will call on color 236, which I thought should be 0,0,0 (black).  But!  On some files, it isn't supposed to be black, but a light gray color... while on others, it is black!  The real fun bit is that the front section of the file where the palette codes are stored are identical.... So I have no clue as to why it is choosing one color over another. ???

So yeah.  Updated list of things I would like help on figuring out:
* Normals
* What determines the color of 236 or 246? (236 for A, Select, VWNAA.  245+ for Vwntu)
« Last Edit: March 05, 2014, 05:27:15 PM by Ford_Prefect »

Online Buster's Uncle

  • In Buster's Orbit, I
  • Ascend
  • *
  • Posts: 49271
  • €440
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: CVR Progress - 2048 normals... :-(
« Reply #25 on: March 05, 2014, 05:27:36 PM »
True black (and a peach shade fdbd76) is semi-transparent in the game - they make the base shadows you don't notice in-game because the flag is in the way.  Those particular shades are unfortunate for custom faction art, because it's all too easy to end up with all the lines on a base see-through, and black bits on the leaderheads.

Offline Ford_Prefect

Re: CVR Progress - 2048 normals... :-(
« Reply #26 on: March 06, 2014, 01:18:22 AM »
Yeah.  I'm stuck.  Without someone who can figure out the proper values for the color issue and more importantly the normals, I won't be able to make any further progress on CVR files.

I'm going to work on tidying up my code and notes and release them here for anyone who is curious or wants to try to help fill in the blanks.

I'll see if with what I do know, if I can do some limited modding of the CVR files... but without all the color and normal data.... it will be really limited. 

I'm sorry I wasn't able to do more.
« Last Edit: March 06, 2014, 03:08:46 PM by Ford_Prefect »

Offline Geo

Re: CVR Progress - 2048 normals... :-(
« Reply #27 on: March 06, 2014, 07:55:55 PM »
You already did more regarding caviar files then anyone else I remember on figuring out them. And for that I thank you, ;b;

Offline Ford_Prefect

First CVR mod!
« Reply #28 on: March 06, 2014, 10:12:11 PM »


http://alphacentauri2.info/index.php?action=downloads;sa=view;down=158

I'll be working on making the color mod tool more user friendly and powerful before releasing it.  Right now I can tell it "replace all of color x with color y".  Without any hints as to what x or y will be. :-D   I'm working on fixing that as well as adding a few features.

Offline Geo

Re: First CVR mod!
« Reply #29 on: March 06, 2014, 10:15:51 PM »
Heh, color-changed faction-unique units?  :unworthy:

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

Proper care and education for our children remains a cornerstone of our entire colonization effort. Children not only shape our future.. they determine in many ways our present. Men and women work harder knowing their children are safe and close at hand, and never forget that, with children present, parents will defend their home to the death!
~Col. Corazon Santiago 'Planet: A Survivalist's Guide'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 38.

[Show Queries]