Thread: [DFBHD] Baldo's New M60 Sight
View Single Post
  #61  
Old 07-14-2022, 03:46 AM
Baldo_the_Don is offline Baldo_the_Don
Baldo_the_Don's Avatar
Registered User

Join Date: Jul 2012
Posts: 531

There are four layers to those PSO sights.

The first layer is the glass graphic. Lessons I've learned from modding the BF2 demo helped here. For the illumination to work best, the illuminated reticle has to be the brightest pixels at that point on the screen. The 'glass' dims the background enough to ensure that. The main attributes to apply here are the multiply/multiplyat draw method and RGB values LOWER than 128. I went with 98 118 108. It dims everything to what I consider a subtle Coke-bottle green, 'cause I'm not young.

The next layer is the reticle drawn in a barely pink 255 26 26 on a grey 125 (RGB 125 125 125) background. Then a 100% alpha layer with 0% alpha over the reticle and a 1px margin all around it. Displayed in game with the multiplyat method.

The multiply draw method means the closer the red, green, and blue values are to 50%, the less it affects color. Grey 127 darkens the tiniest bit. Grey 128 brightens the tiniest bit. Alpha is ignored.

The multiplyat draw method is the same, but allows unblended alpha. If a pixel in the alpha is 127 or less, it's 0% alpha. 128 or more is 100% alpha. I think. I'm pretty sure.

So the alpha on the reticle ensures those pixels are 100% transparent. The 1px grey 125 (49%) margin around the reticle slightly dims that margin. The reticle at 255 26 26 was arrived at by fairly thorough trial and error attempting to minimize that weird warp in visual reality that happens at the edge of red touching blue when you aim skywards. I'm not sure I succeded, but I tried.

The third layer is the reticle drawn mostly in RGB 128 26 26. The chevron is drawn at 255 128 128. The background is black. The draw method is add.

The draw method add means the RGB values of a pixel in this graphic will boost those same RGB values under it. RGB 0 0 0 is 100% transparent. That I have confirmed. I'm unsure how higher RGB values function mathematically, I just know add makes things glowy. Alpha is ignored.

The draw method addat is the same, but allows unblended alpha.

The fourth layer is the scope housing. If everything above bored and/or confused you, the following description will make you want to die.

Changed game video settings to 1024×768, object poly and texture highest, anti-aliasing off. With drudging trial and error testing, in the weapon.def, I edited the pos on the SVD-63 until the view model iron sights were aligned properish, and moving around or firing did not push the model back 'through the screen.' This gave me a base position to work from. Then through more grinding trial and error, I repositioned the weapon 'til the scope was centerish and not breaking the plane. On a sunny map, outside, facing away from the sun and pointing the weapon as high as possible (for preferred shadowing), I made a screenshot. I may have gotten a snack at this point, I misremember, but snacks are mostly a good idea.

Opened the screenshot in my editing software (Photoshop 5.0 LE, came with a camera my wife bought two decades ago, I can't believe I got it to work on this crate). Reduced color saturation to make the image monochrome. Trimmed away the background of the screenshot around the scope (deactivating anti-aliasing for the screenshot makes this easier), including the black line at the bottom (all screenshots from NL games have a black border). Used a tool in this program that locates the brightest pixel. Adjusted the colors until that brightest pixel was grey 56. Grey 64 would've worked, but any pixel brighter than that will glare horribly in the NVGs. Covered the 'glass' with black in a new layer. On a new layer under all this, using the gradient tool, foreground color grey 23, background color grey 5, set to circular with dithering, I made a background of a grey circle fading out to black, centered at the top outer edge of the scope, radius extending to the bottom outer edge of the scope.

Located the center of the scope. On a separate layer, drew a box 512px wide, the top 256px from center, going to the bottom of the scope layer (640px, coincidentally). Using that mask, I selected all the visible layers (the black over the glass, the monochrome scope, the gradient background).

Opened a new project. Inserted the 512×640 image from the screenshot edit. Reduced that to 256×320. Applied a 1.5px gauss blur. This is now the scope texture layer.

On a new layer and using the polygon lasso tool (with edge smoothing activated), selected around the edges of the scope mount, with the shape extending up to the center of the scope. Filled it with a color easily identifiable as not part of the image by just looking at the thumbnail (255 0 255). That's the scope mount mask. New layer with a smooth circle covering to the outer edges of the scope. This is the outer scope mask. Then a new layer with a smooth circle covering to the inner edges of the scope. This is the inner scope mask.

OH MY GOD! I'M ONLY NOW JUST REMEMBERING TO SAVE THIS PROJECT! HOW HAVE I SURVIVED TO SEE 53?! I BETTER CHECK THE FLY ON MY PANTS oh these pajamas don't have zippers. Okay.

Calm. Right. Let's prepare the alpha. Keystrokes described are for my two-decade-old version of PS.

Choose FG color black, BG white. Create a new layer. CTRL+DEL fills the layer with white. Hold CTRL and MOUSE1 click the outer scope mask thumbnail. That circle is now selected. CTRL+SHIFT+I inverts the selection. Add a 7px gauss blur to the selection. ALT+DEL fills the selection with black. Select the outer scope mask again. Invert the selection again. Add a 3px gauss blur this time. Fill the selection with black. Do all that one more time with a 1px gauss blur. Main alpha is prepped.

Create a new layer. CTRL+MOUSE1 click the inner scope mask thumbnail. Add a 7px gauss blur. Fill the selection with black. You should now see a blurry black circle on a blurry white circle on a black background. Rearrange the layers if not. Select the inner scope mask again. Invert the selection. Add 3px blur. Delete the selection. Do that again with 1px blur. Then once more with no blur.

Now create a new layer over the blurry white circle and under the blurry black circle. Select the scope mount mask. Add 1px blur. Fill it with white.

You should see a color inverted representation of the alpha channel you'll apply to the final graphic.

Confirm that you are on one of the visible layers. CTRL+A to select everything. CTRL+SHIFT+C will copy everything selected in all visible layers.

Hide and unhide layers 'til only the scope texture is visible. Press Q to switch to alpha mask edit mode. CTRL+V the alpha layer.

Yes. Done.

Save the project, save the .tga.

Now if the .tga was 256×256, mounting it in the weapons.def would be at 128 0 895 767. I made the .tga longer at the bottom, though, 'cause sometimes, you need to fiddle with mounting sizes, or mount it higher, and the extra at the bottom will be necessary. I mounted it at 128 0 895 959.

I mounted the glass .tga to slightly overlap the inner edge of the scope. That's math to be explained in another future post, though.

The reticle .tgas are basically mounted full size. Details of reticle drawing and mounting will have to wait.

I know I needed to write and post something like this at some point, this tutorial of sorts, and today was the day.

I only hope I get it corrected before the reply edit window closes!

Edit: I think the proofreading is done.

Added the screenshot of the Eotech reticle I made for the SFOD mod. Note that that target item, from the dip in the sandbags in the front to the top of the head is 1.81m. From the top of the sandbags to the top of the head is 1.73m. It's 100m away.
Attached Images
File Type: jpg SFOD_Eotech.jpg (407.8 KB, 21 views)
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\
The NSO Deadline Mod at NovaHQ.net:
/////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\

Last edited by Baldo_the_Don; 07-14-2022 at 12:17 PM.
Reply With Quote