I like using a trick I learned from a fearedse vid, record a bass DI track, duplicate it and reamp one (or don't, just keep the clean DI, that works too sometimes) of the tracks through a bass amp or bass amp sim relatively clean and do the usual processing, compression to hell and back, EQ etc. Then I take the other track and distort it so it sounds like shit on its own, high and low pass to taste (around least 700hz hp 2khz lp) and some surgical cuts if necessary. Usually sits really well when you blend it with the other bass track in the mix, adds some nice grit to the bass.
Another thing that I've tried that works well is splitting the bass DI into 3 tracks, use one track only for the low end (low pass 200-300hz), compress and limit it like you mean it but no distortion. Then I take another track and do the same distortion procedure as above but high pass a bit lower. I use the third track relatively unprocessed, just some high pass (1khz+), possibly a high shelf (-3dB around 8khz is a good place to start), compression and saturation so you get the clank and sheen of the clean DI. Cut frequencies as you see fit, some bass tracks can have a lot of nasty shit going on, usually in the low mids.
If there's a clean passage in a song and you're using the first method, just automate out the grit track.