Jump to content

[1.12.X] Neptune Camera - Basic Camera Utility [4.3][21.06.2023]


Beale

Recommended Posts

Neptune Camera

Download and Releases (GitHub)

Source Code (GitHub)

Only compatible with KSP 1.10.X and above.

Neptune Camera is a utility to add basic camera functionality to parts. Images produced by the camera are saved to the KSP Screenshot folder.
The following features are present:

  • Different camera types (Full colour, Red, Green, Blue, Ultraviolet*, Infrared** and Greyscale).
  • Optional errors (dropped pixels) on images taken.
  • Optional noise grain.
  • Configurable FoV and resolution.
  • Full colour cameras can produce separate Red, Green, Blue, and greyscale images if required.

* The "Ultraviolet" images are produced with a Protanopia colour filter.
** The "Infrared" images are produced with a Tritanopia colour filter.

Examples

Here are a few tiny 128x128 images produced from the launch pad, using various modes of the camera:

DRf9NXJ.pngbMr4KYE.pngadCUM6A.pngCXkmH0Z.pngr88cOsc.png

Here are a few tiny 128x128 images, demonstrating how the R, G, and B images can be stacked to produce cool "exposure effects" when the craft is moving:

JOb4lQK.pngtS9SnRs.pngZ8bua6S.png

Result:

2n5wVdI.png

Images of Kerbin, in ultraviolet and infrared respectively, with some general grain noise.

iOYe4bw.pngvWAclgr.png

A tiny 256x256, full colour image, with no error noise, and an animated sequence of frames.

image_c6334eab-2d53-41bc-8ed0-75a086b11bC8XGpOc.gif

A live preview window can be toggled to view what the camera is currently looking at.

dFHsIMu.jpg1WuTZUt.jpg

Finally, images can even be stacked to create panoramas!

unknown.png?width=1440&height=451
unknown.png?width=1440&height=363

Setting Up Neptune Camera

If you're a part-modder, setting up Neptune Camera is easy!

Step 1, when setting up the part in Unity, add a transform, with Z+ pointing the direction you want the camera to point (Y+ being the "up" direction).

Wqkufzf.jpeg

Step 2, add the Neptune Camera module to your part.

MODULE
{
	name = ModuleNeptuneCamera
	cameraTransformName = cameraTransform
	cameraType = FULL_COLOUR
	cameraHasCustomFieldOfView = True
	cameraFieldOfView = 70
	cameraFieldOfViewMax = 110
	cameraFieldOfViewMin = 20
	cameraHorizontalResolution = 128
	cameraVerticalResolution = 128
	cameraHasErrors = True
	cameraErrorRate = 5
	cameraHasNoise = True
	cameraNoiseMaxStrength = 25
	cameraHasCustomNearClipPlane = True
	cameraCustomNearClipPlane = 0.01
	cameraHasCustomTitle = True
	cameraCustomTitle = "Camera"
	cameraHasDisplayWindow = True
	cameraHasConfigTransform = False
	cameraConfigTransformPosition = 0, 0, -0.125
	cameraConfigTransformDirection = 0, 180, 0
}

A few things are configurable here:

  • cameraTransformName - the name of the transform on the part to attach the camera to.
  • cameraType - the type of camera this is (see below).
  • cameraHasCustomFieldOfView - whether to use a custom field of view.
  • cameraFieldOfView - the field of view of the camera.
  • cameraFieldOfViewMax - the maximum field of view of the camera.
  • cameraFieldOfViewMin - the minimum field of view of the camera.
  • cameraHorizontalResolution - the width of the image produced.
  • cameraVerticalResolution - the height of the image produced.
  • cameraHasErrors - whether errors (dropped pixels) should be added to images produced.
  • cameraErrorRate - the percentage % of the image that will be scrambled with error noise (whole numbers only 1-100).
  • cameraHasNoise - whether noise should be added to the images produced.
  • cameraNoiseMaxStrength - The maximum percentage % strength of the noise produiced (whole numbers only 1-100).
  • cameraHasCustomNearClipPlane - whether a custom near clipping plane should be used.
  • cameraCustomNearClipPlane - the clipping plane distance.
  • cameraHasCustomTitle - whether the camera actions should be prefixed with a custom title (Allow multiple cameras on the same part).
  • cameraCustomTitle - the custom title to use.
  • cameraHasDisplayWindow - Whether a live preview window is available for this camera.
  • cameraHasConfigTransform - whether to use a transform specified in config.
  • cameraConfigTransformPosition - the position of this transform.
  • cameraConfigTransformDirection  - the rotation of this transform.

Values will be defaulted if not specified in the config. You don't need to specify every value in your own config. :)

Valid camera types:

  • FULL_COLOUR
  • FULL_COLOUR_ONLY
  • RED_COLOUR
  • GREEN_COLOUR
  • BLUE_COLOUR
  • GREYSCALE_COLOUR
  • ULTRAVIOLET_COLOUR
  • INFRARED_COLOUR

A note on cameraErrorRate, though this runs 1-100, this value is actually 1-100% of a 10% maximum error rate. Therefore a value of 100 will equal 10% error, and a value of 10 will equal a 1% error rate. You can exceed this if you want, a value of 200 will equal 20% error - but anything above 10% scrambling is basically garbage.

Why?

I wanted a very basic camera util to capture space probe style photographs, I.E. Venera landers:

LoMhwSP.jpg

Another major draw was the idea of creating multiple single colour images and stacking them, to get cool parallax / sliding / exposure effects.

Compatible Mods

TantaresSP

Bluedog Design Bureau (Some support)

Know any others? Let me know and I'll add to the list.

Credits and Special Thanks

This would not be possible without some major help setting up the render-order, culling, and taking care of various other technical hurdles encountered during development.
Without further ado, major thanks to:

These guys are wizards, and it would take me months to get this working without them. My huge gratitude.

Licence

All Rights Reserved

Edited by Beale
Link to comment
Share on other sites

On 8/16/2020 at 3:11 PM, GregroxMun said:

Very nice. Similar to what I was doing with Shol in this tweet thread:

DyRK4oKXcAI5-CG?format=jpg&name=900x900

Yeah this tweet was actually one of the direct inspirations :)

 

Neptune Camera Version 2.1

Added a few new features.

  • Ultraviolet camera mode (protanopia).
  • Infrared camera mode (tritanopia).
  • Configurable camera grain.
  • New error noise generation.

6gf9M66.png

See main post for details of these.

Download and Releases (GitHub)

Source Code (GitHub)

Edited by Beale
Link to comment
Share on other sites

3 minutes ago, Ciko said:

is there a 3d  camera model in this mod?

Nope, this mod is purely a utility for other mods to use.

However, one of my mods, TantaresSP, includes a camera using this right now - with many more on the way.

 

Link to comment
Share on other sites

Interesting.  I'll have to play around with this.

One thought: Have you thought about tying the error rate or noise (or both) to the signal strength of the probe?  That is: you can send a good camera out, but if you're barely in-network you'll get a poor quality picture back.  Then the quality in the part config is the max quality the part can have, under ideal conditions.

Link to comment
Share on other sites

On 8/16/2020 at 8:54 AM, Beale said:

Step 2, add the Neptune Camera module to your part.


MODULE
{
	name = ModuleNeptuneCamera
	cameraTransformName = cameraTransform
	cameraType = FULL_COLOUR
	cameraFieldOfView = 60
	cameraHorizontalResolution = 128
	cameraVerticalResolution = 128
	cameraHasErrors = True
	cameraErrorRate = 5
	cameraHasNoise = True
	cameraNoiseMaxStrength = 25
}

A few things are configurable here:

  • cameraTransformName - the name of the transform on the part to attach the camera to.
  • cameraType - the type of camera this is (see below).
  • cameraFieldOfView - the field of view of the camera.
  • cameraHorizontalResolution - the width of the image produced.
  • cameraVerticalResolution - the height of the image produced.
  • cameraHasErrors - whether errors (dropped pixels) should be added to images produced.
  • cameraErrorRate - the percentage % of the image that will be scrambled with error noise (whole numbers only 1-100).
  • cameraHasNoise - whether noise should be added to the images produced.
  • cameraNoiseMaxStrength - The maximum percentage % strength of the noise produiced (whole numbers only 1-100).

Valid camera types:

  • FULL_COLOUR
  • RED_COLOUR
  • GREEN_COLOUR
  • BLUE_COLOUR
  • GREYSCALE_COLOUR
  • ULTRAVIOLET_COLOUR
  • INFRARED_COLOUR

I'm a bit confused with this. I'm not a modder. So how do I integrate this mod with Tantares SP?

Link to comment
Share on other sites

5 minutes ago, gabo04 said:

I'm a bit confused with this. I'm not a modder. So how do I integrate this mod with Tantares SP?

If you have TantaresSP, just download this and put in GameData :)

TantaresSP is already pre-configured to use this mod, and has a lot more cameras on the way if you are using the WIP version from GitHub (Full release soon).

On 8/26/2020 at 7:50 PM, DStaal said:

Interesting.  I'll have to play around with this.

One thought: Have you thought about tying the error rate or noise (or both) to the signal strength of the probe?  That is: you can send a good camera out, but if you're barely in-network you'll get a poor quality picture back.  Then the quality in the part config is the max quality the part can have, under ideal conditions.

It's a cool idea, but I'm not sure on the logistics i.e. analoue TV signal vs. electrical bit-by-bit camera image.

I'll investigate.

 

Link to comment
Share on other sites

3 hours ago, Beale said:

If you have TantaresSP, just download this and put in GameData :)

TantaresSP is already pre-configured to use this mod, and has a lot more cameras on the way if you are using the WIP version from GitHub (Full release soon).

OK.Thanks. :wink:

Link to comment
Share on other sites

20 hours ago, Beale said:

It's a cool idea, but I'm not sure on the logistics i.e. analoue TV signal vs. electrical bit-by-bit camera image.

I'll investigate.

Digital could be fairly resistant to the error level - but at an expense: It would allow you to *detect* errors in transmission, but *fixing* them either requires always transmitting a large overhead of checksums (which also requires extra processing at the remote end before send), or you have to have the remote resend the image (or some portion of the image) if there's an error.  (You could of course ignore errors in a portion of an image if you've blocked your images correctly - which would be how you get the noise pattern in the current version.)

Analogue lets more noise get in, but you can still get a fairly useful image even with a lot of noise.

Either of these can be alleviated by slowing down transmission of course.

Link to comment
Share on other sites

On 8/31/2020 at 2:54 PM, DStaal said:

Digital could be fairly resistant to the error level - but at an expense: It would allow you to *detect* errors in transmission, but *fixing* them either requires always transmitting a large overhead of checksums (which also requires extra processing at the remote end before send), or you have to have the remote resend the image (or some portion of the image) if there's an error.  (You could of course ignore errors in a portion of an image if you've blocked your images correctly - which would be how you get the noise pattern in the current version.)

Analogue lets more noise get in, but you can still get a fairly useful image even with a lot of noise.

Either of these can be alleviated by slowing down transmission of course.

Interesting ideas! I'll look into them.

 

Neptune Camera V2.3

Download and Releases (GitHub)

Source Code (GitHub)

Exported images now have a sensible naming scheme, ordered by date descending.
Tweaks have been made to allow camera stats shown in VAB.

d63IWW3.jpeg

unknown.png?width=1440&height=451

Link to comment
Share on other sites

Any idea if this should work with 1.8? TantaresSP and all other things work fine for me but the camera's aren't making screenshots..  

Console gives me TypeloadException, couldnt resolve type token 01000033 (from typeref class/assembly GraphicsType)

Is this due to new functionalities brought in later game updates? Cuz then I'll just forget about it. 

Edited by Black034
Link to comment
Share on other sites

On 9/15/2020 at 12:40 PM, Black034 said:

Any idea if this should work with 1.8? TantaresSP and all other things work fine for me but the camera's aren't making screenshots..  

Console gives me TypeloadException, couldnt resolve type token 01000033 (from typeref class/assembly GraphicsType)

Is this due to new functionalities brought in later game updates? Cuz then I'll just forget about it. 

Unfortunately yes you are correct, the camera was changed in 1.9, which makes 1.8 compatibility sadly a little difficult, thanks for understanding.

 

 

Neptune Camera V2.4

Download and Releases (GitHub)

Source Code (GitHub)

Cameras can now have custom clipping planes.
Error-noise generation behaviour has been tweaked (details to be added to OP).

qX8B0MD.jpg

Link to comment
Share on other sites

  • 4 weeks later...
On 9/18/2020 at 9:43 AM, NateDaBeast said:

Not sure why, but I've looked into using this mod and I don't see any of the photos in my KSP screenshot folder.

11 hours ago, The_Arcitect said:

How do I get the camera working, I cant seem to take picures.

Are you both using Ksp 1.10.1?

 

Link to comment
Share on other sites

  • 3 weeks later...

Would you say that the camera transform step is particularly difficult? I ask because I would like to apply the module to other mods I have installed but I don't have any experience with Unity. (Although I do feel confident in my ability to edit text files :D

Thanks : )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...