User Tools

Site Tools


hpl3:community:other:hpl2_import

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:community:other:hpl2_import [2015/10/10 21:30]
romulator [Importing Models from HPL2]
hpl3:community:other:hpl2_import [2020/02/11 19:43] (current)
timan [Other problems? Questions?]
Line 1: Line 1:
 ====== Importing Models from HPL2 ====== ====== Importing Models from HPL2 ======
  
-<​note>​Errors may come up when your models ​are exported ​to your custom storyLooking into it.+Importing ​models ​from HPL2 to HPL3 is not a complex process but will involve needing to "​convert"​ textures to a format that HPL3 understandsThere are some problems which you may face, and this tutorial is here to try and tackle some of the errors and give you a basic idea of importing models from Amnesia: The Dark Descent and Amnesia: A Machine For Pigs.
  
-- Romulator (11 Oct 2015)</​note>​+==== Legal Information ====
  
-Importing ​models ​has become much easier than what I had originally thought. There are some problems which you are likely to face, and this tutorial is here to try and tackle some of the errors and give you a basic idea of importing models from Amnesia: The Dark Descent and Amnesia: A Machine For Pigs.+Please refrain from importing these models and releasing the entirety of them. By following ​this tutorial, it is assumed ​you have legally purchased copy of Amnesia: The Dark Descent and/or Amnesia: A Machine For Pigs. While I cannot stop you from performing these steps, please consider some respect for the modellers and their works by purchasing the games.
  
-==== Legal Information ====+----
  
-Please refrain from importing these models and releasing the entireity of themBy following this tutorialit is assumed you have a legally purchased copy of Amnesia: The Dark Descent and/or Amnesia: A Machine For Pigs. While I cannot stop you from performing these steps, please consider some respect for the modellers and their works by purchasing the games.+**<font 24.0pt/arial,sans-serif;;#​333333;;​inherit>​Converting HPL2 Textures to HPL3</font> ​   **
  
-===== Importing ​to the Level Editor =====+<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Not too long ago, Frictional released the</​font> ​   [[http://​steamcommunity.com/​sharedfiles/​filedetails/?​id=570600440|Amnesia:​ The Dark Descent Asset Pack]]<​font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>,​ giving us the wealth of A:TDD assets ​to use in HPL3, which is great news if you are an Amnesia modder looking to venture into the (albeit, semi-scary) world of HPL3 scripting. However, if you are planning on making a mod that doesn’t involve underwater stations and bloodthirsty anglerfish, then you’ll probably be pulling assets from Penumbra and Machine for Pigs as well.</​font>​
  
-==== How can I import Static Objects? ====+<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​When loading a Machine for Pigs asset (for example) into the HPL3 Model Viewer, you’ll likely be confronted with this:</​font>​
  
-Static Objects are arguably, very easy to import. ​It is more or less just a copy and paste of the static_objects ​you require ​in question into SOMA's static_objects folder. For the sake of examples, I will use mansionbase,​ since mansionbase is probably the most common.+{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_01.jpg?​nolink&​500x594}} 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​(Assets placed into a single folder before loading the model):</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​Machine for Pigs\static_objects\new_church\pillar:</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​NC_pillar_arch_heavy.dae</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​Machine for Pigs\static_objects\new_church:</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​NC_wall_details.dds</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​NC_wall_details_nrm.dds</​font>​ 
 + 
 +<font 9px/​inherit;;​inherit;;​inherit>​NC_wall_details_spec.dds</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​You’ll notice that the lighting reacts very strangely when using “Keylight on Camera” and that an odd green sheen can be seen tween the edges in the scene. This is because of a change over the way that specular textures (file_spec.dds) and normal textures (file_nrm.dds) are interpreted in HPL3.</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​This section will present a guide of how to convert these specular and normal textures from HPL2 format to HPL3 format using Photoshop CS6 with the</​font> ​   [[https://​developer.nvidia.com/​nvidia-texture-tools-adobe-photoshop|Nvidia DDS Exporter]] <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​plugin</​font> ​   <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​. GIMP users can also follow the manual process below provided the GIMP DDS exporter is installed.</​font>​ 
 + 
 +**<font 24.0pt/​arial,​sans-serif;;#​333333;;​inherit>​Converting a Specular Texture</​font> ​   ** 
 + 
 +**__<​font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Method 1: Photoshop Script</​font> ​   __ ** 
 +  - <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Save the following block of code in an administrative-level text editor as  __ HPL2specConvert.jsx ​ __ under</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​C:​\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts\</​font> ​   <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​(or wherever your Photoshop installation is…)</​font>​ 
 + 
 +<​code>​ 
 +if (documents.length>​ 0) { 
 +alert("​Document is open, press ok to convert."​);​ 
 +var theImage = app.activeDocument;​ 
 +// Unlock background layer 
 +var layers = activeDocument.layers;​ 
 +var layer = layers[layers.length - 1]; 
 +// rename Background layer 
 +if (layer.isBackgroundLayer) { 
 +layer.name = '​Background';​ 
 +
 +// Save channel names 
 +var red = theImage.channels.getByName("​Red"​);​ 
 +var green = theImage.channels.getByName("​Green"​);​ 
 +var blue = theImage.channels.getByName("​Blue"​);​ 
 +if (theImage.channels.length>​ 3){ // If there are 4 channels, alpha is probably last one 
 +var alpha = theImage.channels[theImage.channels.length - 1] 
 +alert(alpha);​ 
 +
 +else{ 
 +var alpha = theImage.channels.add();​ 
 +alpha.name = "Alpha 1"; 
 +
 +var aChannelArray = new Array(); 
 +// Set only GREEN channel active 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = green; 
 +theImage.activeChannels = aChannelArray;​ 
 +// Select all 
 +theImage.selection.selectAll();​ 
 +// Copy 
 +theImage.selection.copy();​ 
 +// Set alpha channel active 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = alpha; 
 +theImage.activeChannels = aChannelArray;​ 
 +// Paste 
 +theImage.paste();​ 
 +// Set only RED channel active 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = red; 
 +theImage.activeChannels = aChannelArray;​ 
 +// Select all 
 +theImage.selection.selectAll();​ 
 +// Copy 
 +theImage.selection.copy();​ 
 +// Set GREEN active and paste 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = green; 
 +theImage.activeChannels = aChannelArray;​ 
 +theImage.paste();​ 
 +// Set BLUE active and paste 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = blue; 
 +theImage.activeChannels = aChannelArray;​ 
 +theImage.paste();​ 
 +// REACTIVATE ALL CHANNELS 
 +aChannelArray = new Array(); 
 +aChannelArray[0] = red; 
 +aChannelArray[1] = green; 
 +aChannelArray[2] = blue; 
 +// now activate them for realz 
 +theImage.activeChannels = aChannelArray;​ 
 +
 +else { 
 +alert("​No doc open"​);​ 
 +
 +</​code>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​2. Open the specular texture in Photoshop and run the script from File > Scripts > HPL2specConvert</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​3. Save as a .DDS file of type DXT5, preferably with “_spec” still appended to the end of the filename</​font>​ 
 + 
 +**__<​font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Method 2: Manual</​font> ​   __ ** 
 +  - <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Open the specular texture in Photoshop.</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_03.jpg?​nolink&​500x289}} 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​An HPL2 image such as this AAMFP texture will appear as green, because HPL2 relies on the individual channels for specular information,​ where  __ Red = Intensity, Green = Power, and Blue = Unused (black) ​ __ . The HPL3 format relies on Red, Green, and Blue for Intensity, and relies on the Alpha channel for Power.</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​For more information,​ look at the</​font> ​   [[https://​wiki.frictionalgames.com/​hpl3/​tutorials/​basic_modeling|HPL3 Modeling Tutorial]] 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Our goal is to create a copy of the intensity channel on the Red, Green, and Blue channels, and move the power channel to the Alpha channel.</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​2. Go to the “Channels” tab next to Layers, and select only the green channel. Select with Ctrl-A and copy the channel to the clipboard.</​font>​ 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​3. If an “Alpha” channel already exists, select it, otherwise create a new channel using the button at the bottom of the pane and paste into the Alpha layer.</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_04.jpg?​nolink&​500x293}} 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​4. Select the Red channel, Ctrl-A, copy, then select the Green channel and Blue channel individually,​ pasting the same (red channel) clipboard image each time</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_05.jpg?​nolink&​500x291}} 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​5. Save as a .DDS file of type DXT5, preferably with “_spec” still appended to the end of the filename</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_02.jpg?​nolink&​500x453}} 
 + 
 +**<font 24.0pt/​arial,​sans-serif;;#​333333;;​inherit>​Converting a Normal Texture</​font> ​   ** 
 +  - <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Simply open the normal texture (typically _nrm appended to filename) and save using the NVIDIA exporter in the  __ 3DC format ​ __ . Do not forget to switch this back to DXT5 when exporting other DDS textures.</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_06.jpg?​nolink&​500x323}} 
 + 
 +<font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​If all is well and good, you should have an asset with working lighting and proper specular highlights, ready for you to place in your HPL3 map.</​font>​ 
 + 
 +{{https://​wiki.frictionalgames.com/​_media/​hpl3/​community/​hpl2_asset_tut_07.jpg?​nolink&​600x468}} \\ <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​Note that if the object is an entity, you might have to open the .ent file with the Model Editor and save the file again, then test to see that the entity is still functioning properly and make adjustments- see the below sections</​font> ​   <font 10.5pt/​arial,​sans-serif;;#​333333;;​inherit>​.</​font>​ 
 + 
 +---- 
 + 
 +====== Importing to the Level Editor ====== 
 + 
 +**How can I import Static Objects?​** 
 + 
 +Static Objects are arguably, very easy to import. ​After converting the textures, it is more or less just a copy and paste of the static_objects in question ​(plus their textures) ​into SOMA's static_objects folder, or your mod's directory. For the sake of examples, I will use mansionbase,​ since mansionbase is probably the most common.
  
 Create a new folder in your SOMA's static_objects directory and call it amnesia. If you are using Steam on a Windows system, this is the directory you should be making: Create a new folder in your SOMA's static_objects directory and call it amnesia. If you are using Steam on a Windows system, this is the directory you should be making:
Line 23: Line 163:
 </​file>​ </​file>​
  
-Paste any Amnesia static_object folder(s) into there. In my particular case, I have only added mansionbase,​ thus I have this layout right now.+Paste any Amnesia static_object folder(s) into there, then modify the textures. In my particular case, I have only added mansionbase,​ thus I have this layout right now.
  
 {{http://​puu.sh/​kz7uV/​67a16f19a7.png?​direct&​800}} {{http://​puu.sh/​kz7uV/​67a16f19a7.png?​direct&​800}}
Line 67: Line 207:
 ==== How can I import Enemies? ==== ==== How can I import Enemies? ====
  
-<​note>​The Manpigs from Amnesia: A Machine For Pigs are currently untested. I will look into this at later time.</​note>​ +<​note>​Editing the enemies to have their own sounds requires making ​new class for those enemies in SOMA's Script folderIn the below tutorialthe Brute will mimic the Construct ​sounds.</​note>​
- +
-<​note>​At currentbecause I am not fully aware of making custom classes, monsters you import ​will not have the sounds ​they usually had in their previous games. I will look into this at a later time.</​note>​+
  
 Import the enemies just like in the entity tutorial above until you get to the Model Editor step. Load up the enemy. You may get a prompt when loading up the enemy. Just press OK and you should be good to go. In the case of Amnesia'​s notorious Servant Brute, we will load it up and be greeted by this. Import the enemies just like in the entity tutorial above until you get to the Model Editor step. Load up the enemy. You may get a prompt when loading up the enemy. Just press OK and you should be good to go. In the case of Amnesia'​s notorious Servant Brute, we will load it up and be greeted by this.
Line 99: Line 237:
 This will generically be caused by one of two things: This will generically be caused by one of two things:
  
-    ​- **The model cannot find all connected submeshes.** ​ \\ This means that there is a model or .dae file missing. You will know this is the case if when you place down a model and it does not appear in the editor (see the image above), and upon clicking where it is placed, does not actually select the model. To fix this, you'll need to open the model in the HPL2 Model Editor and locate where the referenced models are located in The Dark Descent or in Machine For Pigs. Make sure you copy all of them over into your SOMA directory, and it would be a good idea to try and keep them as close to the original directory as possible. +  ​- **The model cannot find all connected submeshes.** ​ \\ This means that there is a model or .dae file missing. You will know this is the case if when you place down a model and it does not appear in the editor (see the image above), and upon clicking where it is placed, does not actually select the model. To fix this, you'll need to open the model in the HPL2 Model Editor and locate where the referenced models are located in The Dark Descent or in Machine For Pigs. Make sure you copy all of them over into your SOMA directory, and it would be a good idea to try and keep them as close to the original directory as possible. 
-    - **The model has all of its components but not its material (or all of its textures).** ​ \\ This means you do not have the material or the textures (or even just the diffuse texture) in a recognisable location for your entity or static object. An example that comes to mind is the towels in A Machine For Pigs, as they base their texture off a carpet material file. To check what material it uses, you can open up the model in the HPL2 Model Editor and press the [+] button next to the mesh. It should show you the name of the .dds textures. Most of the time, all the materials and .dds files will appear there, but you can get all of them.+  - **The model has all of its components but not its material (or all of its textures).** ​ \\ This means you do not have the material or the textures (or even just the diffuse texture) in a recognisable location for your entity or static object. An example that comes to mind is the towels in A Machine For Pigs, as they base their texture off a carpet material file. To check what material it uses, you can open up the model in the HPL2 Model Editor and press the [+] button next to the mesh. It should show you the name of the .dds textures. Most of the time, all the materials and .dds files will appear there, but you can get all of them.
 ==== When testing my level, my model appears at XYZ = 0. ==== ==== When testing my level, my model appears at XYZ = 0. ====
  
Line 107: Line 245:
 ===== Other problems? Questions? ===== ===== Other problems? Questions? =====
  
-If you have any questions or face other problems, please, feel free to start a thread in [[https://www.frictionalgames.com/forum/forum-82.html|SOMA'​s Development support forum]], or drop a [[https://​www.frictionalgames.com/​forum/​private.php?​action=send&​uid=27667|Personal Message to Romulator]] on the forum. I may not be able to solve all problems, but if I cannot, I'll just ask you create a thread.+If you have any questions or face other problems, please, feel free to start a thread in the [[https://discordapp.com/invite/​frictionalgames|Frictional Games Discord Server]]
  
hpl3/community/other/hpl2_import.1444512657.txt.gz · Last modified: 2015/10/10 21:30 by romulator